コード例 #1
0
 def test_update_an_existing_brand_should_be_done(self):
     brand = BrandFactory.create()
     data = BrandFactory.attributes()
     resp = self.post('/admin/brand/' + str(brand.uid) + '/update', data)
     brand.reload()
     expect(brand.name).to_equal(data.get('name'))
     expect(brand.image).to_include(data.get('image'))
コード例 #2
0
 def test_create_product_should_response_status_201(self):
     product = ProductFactory.attributes()
     category = CategoryFactory.create()
     brand = BrandFactory.create()
     product['category'] = category.id
     product['brand'] = brand.id
     resp = self.post('/admin/product/',product)
     expect(resp.status_int).to_equal(201)
コード例 #3
0
 def test_create_product_should_response_correct_data(self):
     product = ProductFactory.attributes()
     category = CategoryFactory.create()
     brand = BrandFactory.create()
     product['category'] = category.id
     product['brand'] = brand.id
     resp = self.post('/admin/product/',product)
     expect(resp).to_include(product['name'])
     expect(resp).to_include(product['sku'])
     expect(resp).to_include(unicode(category.name))
     expect(resp).to_include(unicode(brand.name))
     expect(resp).to_include(unicode(product['price']))
     expect(resp).to_include(str(product['selling_price']))
     expect(resp).to_include(str(product['discount']))
コード例 #4
0
 def test_delete_exist_user_should_be_done(self):
     brand = BrandFactory.create()
     resp = self.post('/admin/brand/' + str(brand.uid) + '/delete',{})
     expect(len(Brand.objects(uid=brand.uid))).to_equal(0)
コード例 #5
0
 def test_delete_existing_user_should_response_status_200(self):
     brand = BrandFactory.create()
     resp = self.post('/admin/brand/' + str(brand.uid) + '/delete',{})
     expect(resp.status_int).to_equal(200)
コード例 #6
0
 def test_update_an_existing_brand_should_response_status_200(self):
     brand = BrandFactory.create()
     data = BrandFactory.attributes()
     resp = self.post('/admin/brand/' + str(brand.uid) + '/update', data)
     expect(resp.status_int).to_equal(200)
コード例 #7
0
 def test_get_exist_brand_response_correct_data(self):
     brand = BrandFactory.create()
     resp = self.get('/admin/brand/' + str(brand.uid))
     expect(resp).to_include(brand.name)
コード例 #8
0
 def test_get_exist_brand_response_status_200(self):
     brand = BrandFactory.create()
     resp = self.get('/admin/brand/' + str(brand.uid))
     expect(resp.status_int).to_equal(200)