Feat: GET search_products by name
This commit is contained in:
		| @@ -98,11 +98,11 @@ class DonConfiaoApiRouteTestCase( | ||||
|             ProductTemplate = pool.get('product.template') | ||||
|             Product = pool.get('product.product') | ||||
|             Uom = pool.get('product.uom') | ||||
|             template, = ProductTemplate.create([ | ||||
|                 {'name': 'Product', | ||||
|                  'default_uom': Uom.search([('name', '=', 'Unit')])[0].id | ||||
|                  } | ||||
|             ]) | ||||
|             template, = ProductTemplate.create([{ | ||||
|                 'name': 'Product', | ||||
|                 'default_uom': Uom.search([('name', '=', 'Unit')])[0].id, | ||||
|                 'list_price': 5000 | ||||
|             }]) | ||||
|  | ||||
|             Product.create([{'template': template.id}]) | ||||
|  | ||||
| @@ -118,6 +118,20 @@ class DonConfiaoApiRouteTestCase( | ||||
|         self.assertEqual(response.status_code, HTTPStatus.OK) | ||||
|         self.assertEqual(len(products), 1) | ||||
|  | ||||
|     def test_search_products(self): | ||||
|         client = self.client() | ||||
|         response = client.get( | ||||
|             f'/{self.db_name}/sale_don_confiao/search_products/product', | ||||
|             headers={ | ||||
|                 'Authorization': f'bearer {self.key}', | ||||
|             }) | ||||
|  | ||||
|         products = json.loads( | ||||
|             response.get_data().decode()) | ||||
|  | ||||
|         raise Exception(products) | ||||
|         self.assertEqual(response.status_code, HTTPStatus.OK) | ||||
|  | ||||
|     def test_get_sales(self): | ||||
|         pool = Pool(DB_NAME) | ||||
|         transaction = Transaction().start(DB_NAME, user=0, _lock_tables=[ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user