コード例 #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_not_existing_brand_should_response_status_404(self):
     data = BrandFactory.attributes()
     resp = self.post('/admin/brand/1001/update', data)
     expect(resp.status_int).to_equal(404)
コード例 #7
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)
コード例 #8
0
 def test_create_a_brand_should_response_correct_data(self):
     data = BrandFactory.attributes()
     resp = self.post('/admin/brand/', data)
     expect(resp).to_include(data.get('name'))
コード例 #9
0
 def test_create_a_brand_should_response_status_201(self):
     data = BrandFactory.attributes()
     resp = self.post('/admin/brand/', data)
     expect(resp.status_int).to_equal(201)
コード例 #10
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)
コード例 #11
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)
コード例 #12
0
ファイル: test_brand.py プロジェクト: phuclc/dienthoai
 def test_get_data_from_existing_brand(self):
     attr = BrandFactory.attributes()
     data = brand.create(attr)
     b = brand.get(data.uid)
     expect(b.name).to_equal(data.name)
コード例 #13
0
ファイル: test_brand.py プロジェクト: phuclc/dienthoai
 def test_create_brand_should_work(self):
     attr = BrandFactory.attributes()
     b = brand.create(attr)
     expect(b.name).to_equal(attr.get("name"))