Ejemplo n.º 1
0
 def get(self, name):
     """ Possible to search with wild card also /products/na*. If star is is missing then the exact
         match will be searched """
     try:
         if name.endswith('*'):
             result = [
                 i for i in DatabaseInterface.search_product_by_substring(
                     name[:-1])
             ]
             if not result:
                 abort(404,
                       message="Product with name {} does not exist".format(
                           name))
             return result
         else:
             return DatabaseInterface.search_product_by_name(name)
     except ProductNotFoundException:
         abort(404,
               message="Product with name {} does not exist".format(name))
Ejemplo n.º 2
0
 def test_search_product_by_name(cls):
     cls._create_dummy_basket()
     result = DatabaseInterface.search_product_by_name('name')
     assert result