Esempio n. 1
0
def test_get_products(session):  # pylint:disable=unused-argument
    """Assert that the product list can be retrieved."""
    response = ProductService.get_products()
    assert response
    # assert the structure is correct by checking for name, description properties in each element
    for item in response:
        assert item['name'] and item['description']
Esempio n. 2
0
 def get():
     """Get a list of all products."""
     try:
         response, status = json.dumps(ProductService.get_products()), http_status.HTTP_200_OK
     except BusinessException as exception:
         response, status = {'code': exception.code, 'message': exception.message}, exception.status_code
     return response, status