def test_update_exist_product_should_response_status_200(self):
     product = ProductFactory.create()
     data = ProductFactory.attributes()
     del data['category']
     del data['brand']
     resp = self.post('/admin/product/' + str(product.id) + '/update', data)
     expect(resp.status_int).to_equal(200)
 def test_update_an_category_vicious_cycle_should_return_status_400(self):
     category = CategoryWithParentFactory.create()
     parent = category.parent
     data = CategoryWithParentFactory.attributes()
     data['parent'] = category.id;
     resp = self.post('/admin/category/' + str(parent.id) + '/update', data)
     expect(resp.status_int).to_equal(400)
Ejemplo n.º 3
0
 def test_update_an_exist_user_should_be_done(self):
     user = UserFactory.create()
     data = UserFactory.attributes()
     resp = self.post('/admin/user/' + str(user.uid) + '/update', data)
     user.reload()
     expect(user.username).to_equal(data.get('username'))
     expect(user.email).to_include(data.get('email'))
Ejemplo n.º 4
0
 def test_update_an_existing_sticky_should_be_done(self):
     sticky = StickyFactory.create()
     data = StickyFactory.attributes()
     resp = self.post('/admin/sticky/' + str(sticky.id) + '/update', data)
     sticky.reload()
     expect(sticky.name).to_equal(data.get('name'))
     expect(sticky.image).to_include(data.get('image'))
Ejemplo n.º 5
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'))
 def test_update_an_exist_category_should_response_status_200(self):
     category = CategoryWithParentFactory.create()
     data = CategoryWithParentFactory.attributes()
     parent = CategoryFactory.create()
     data['parent'] = str(parent['id'])
     resp = self.post('/admin/category/' + str(category.id) + '/update', data)
     expect(resp.status_int).to_equal(200)
 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)
 def test_update_an_exist_product_should_be_done(self):
     product = ProductFactory.create()
     data = ProductFactory.attributes()
     del data['category']
     del data['brand']
     resp = self.post('/admin/product/' + str(product.id) + '/update', data)
     product.reload()
     expect(product.name).to_equal(data.get('name'))
     expect(product.sku).to_include(data.get('sku'))
     expect(resp).to_include(unicode(data.get('price')))
     expect(resp).to_include(data.get('selling_price'))
     expect(resp).to_include(data.get('discount'))
 def test_update_an_exist_category_should_be_done(self):
     category = CategoryWithParentFactory.create()
     data = CategoryWithParentFactory.attributes()
     data['parent'] = str(category['parent']['id'])
     resp = self.post('/admin/category/' + str(category.id) + '/update', data)
     expect(resp).to_include(data.get('parent'))
     expect(resp).to_include(data.get('name'))
     expect(resp).to_include(data.get('image'))
 def test_create_a_category_with_parent_should_response_correct_data(self):
     parent = CategoryFactory.create()
     category = CategoryWithParentFactory.attributes()
     category['parent'] =  parent.id
     resp = self.post('/admin/category/', category)
     expect(resp).to_include(category.get('name'))
     expect(resp).to_include(category.get('image'))
     expect(resp).to_include(unicode(category.get('parent')))
 def test_create_a_category_with_parent_should_response_status_201(self):
     parent = CategoryFactory.create()
     category = CategoryWithParentFactory.attributes()
     category['parent']=parent.id
     resp = self.post('/admin/category/', category)
     expect(resp.status_int).to_equal(201)
 def test_create_a_category_with_empty_parent_should_response_status_201(self):
     category = CategoryFactory.attributes()
     resp = self.post('/admin/category/', category)
     expect(resp.status_int).to_equal(201)
 def test_get_not_exist_category_response_status_404(self):
     resp = self.get('/admin/category/1001')
     expect(resp.status_int).to_equal(404)
Ejemplo n.º 14
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'))
 def test_update_an_category_not_exist_parent_should_return_status_400(self):
     category = CategoryWithParentFactory.create()
     data = CategoryWithParentFactory.attributes()
     data['parent'] = str(category['parent']['id']) + "10"
     resp = self.post('/admin/category/' + str(category.id) + '/update', data)
     expect(resp.status_int).to_equal(400)
Ejemplo n.º 16
0
 def test_after_create_user_api_should_return_status_200(self):
     resp = self.get('/api/v1/users/' + str(self.user.id))
     expect(resp.status_int).to_equal(200)
 def test_create_a_category_with_empty_parent_should_response_correct_data(self):
     category = CategoryFactory.attributes()
     resp = self.post('/admin/category/', category)
     expect(resp).to_include(category.get('name'))
     expect(resp).to_include(category.get('image'))
 def test_delete_exist_category_should_be_done(self):
     category = CategoryFactory.create()
     resp = self.post('/admin/category/' + str(category.id) + '/delete',{})
     expect(len(Category.objects(id=category.id))).to_equal(0)
Ejemplo n.º 19
0
 def test_after_create_user_api_should_return_correct_data(self):
     resp = self.get('/api/v1/users/' + str(self.user.id))
     expect(resp.body).to_include(self.user.email)
Ejemplo n.º 20
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)
Ejemplo n.º 21
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)
Ejemplo n.º 22
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)
Ejemplo n.º 23
0
 def test_get_not_exist_brand_response_status_404(self):
     resp = self.get('/admin/brand/1001')
     expect(resp.status_int).to_equal(404)
Ejemplo n.º 24
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)
 def test_create_a_category_with_not_enough_data_properties_sould_response_status_400(self):
     category = CategoryFactory.attributes()
     del category['name']
     resp = self.post('/admin/category/', category)
     expect(resp.status_int).to_equal(400)
 def test_create_a_category_with_exist_category_name_sould_response_status_400(self):
     category = CategoryWithParentFactory.create()
     data = CategoryFactory.attributes()
     data['name'] = category.name
     resp = self.post('/admin/category/', data)
     expect(resp.status_int).to_equal(400)
Ejemplo n.º 27
0
 def test_user_list_should_return_status_200(self):
     resp = self.get('/api/v1/users/')
     expect(resp.status_int).to_equal(200)
 def test_get_list_category_should_response_status_200(self):
     resp = self.get('/admin/category/')
     expect(resp.status_int).to_equal(200)
 def test_get_exist_category_response_status_200(self):
     category = CategoryWithParentFactory.create()
     resp = self.get('/admin/category/' + str(category.id))
     expect(resp.status_int).to_equal(200)
 def test_update_an_category_not_exist_should_return_status_400(self):    
     data = CategoryWithParentFactory.attributes()
     resp = self.post('/admin/category/' + '1' + '/update', data)
     expect(resp.status_int).to_equal(400)
 def test_get_exist_category_response_correct_data(self):
     category = CategoryWithParentFactory.create()
     resp = self.get('/admin/category/' + str(category.id))
     expect(resp).to_include(category.name)
     expect(resp).to_include(category.image)
 def test_delete_not_exist_category_should_response_status_404(self):
     resp = self.post('/admin/category/111/delete', {})
     expect(resp.status_int).to_equal(404)    
Ejemplo n.º 33
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)