def test_simple_paging(self):
     page = dal_products.get_products(count=2)
     self.assertEqual(len(page), 2)
     self.assertEqual(page[0]["sku"], 42534)
     page = dal_products.get_products(after=64124, count=2)
     self.assertEqual(len(page), 2)
     self.assertEqual(page[0]["sku"], 65908)
     self.assertEqual(page[1]["sku"], 81263)
     page = dal_products.get_products(before=1070373, count=3)
     self.assertEqual(len(page), 3)
     self.assertEqual(page[0]["sku"], 81263)
     self.assertEqual(page[1]["sku"], 99915)
Exemple #2
0
 def test_paging_during_load(self):
     page = dal_products.get_products(count=2)
     self.assertEqual(len(page), 2)
     self.assertEqual(page[0]["sku"], 42534)
     self.assertEqual(page[1]["sku"], 64124)
     page = dal_products.get_products(after=64124, count=2)
     self.assertEqual(len(page), 2)
     self.assertEqual(page[0]["sku"], 65908)
     self.assertEqual(page[1]["sku"], 81263)
     dal_products.process_new_entry(new_load)
     page = dal_products.get_products(before=65908, count=2)
     self.assertEqual(len(page), 2)
     self.assertEqual(page[0]["sku"], 42535)
     self.assertEqual(page[1]["sku"], 64124)
Exemple #3
0
def get_product(name):
    """Gets all products for the company"""

    products = get_products({'producer': name})

    return response(
        'Successfully retreived all the products for company ' + name, 200,
        {'data': {
            'products': products
        }})
Exemple #4
0
 def tearDown(self):
     dal_products.clear()
     self.assertEqual(len(dal_products.get_products()), 0)
     dal_products.disconnect()
Exemple #5
0
 def setUp(self):
     dal_products.connect(mongo_config)
     dal_products.clear()
     [dal_products.process_new_entry(p) for p in data]
     self.assertEqual(len(dal_products.get_products()), unique_entries)
 def test_by_producer(self):
     page = dal_products.get_products(producer="America's Asparagus")
     self.assertEqual(len(page), 1)
     self.assertEqual(page[0]["sku"], 42534)