import unittest
from app import app

class ProductServiceTestCase(unittest.TestCase):
    def setUp(self):
        self.app = app.test_client()
        self.app.testing = True

    def test_get_all_products(self):
        response = self.app.get('/products')
        self.assertEqual(response.status_code, 200)
        self.assertIsInstance(response.json, list)

    def test_get_product_by_id(self):
        response = self.app.get('/products/101')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['id'], '101')

    def test_get_product_not_found(self):
        response = self.app.get('/products/999')
        self.assertEqual(response.status_code, 404)

if __name__ == '__main__':
    unittest.main()
