本文整理汇总了Python中tests.expect函数的典型用法代码示例。如果您正苦于以下问题:Python expect函数的具体用法?Python expect怎么用?Python expect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_exist_product_should_response_status_200
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)
示例2: test_update_an_category_vicious_cycle_should_return_status_400
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)
示例3: test_update_an_exist_user_should_be_done
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'))
示例4: test_update_an_existing_sticky_should_be_done
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'))
示例5: test_update_an_existing_brand_should_be_done
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'))
示例6: test_update_an_exist_category_should_response_status_200
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)
示例7: test_create_product_should_response_status_201
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)
示例8: test_update_an_exist_product_should_be_done
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'))
示例9: test_update_an_exist_category_should_be_done
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'))
示例10: test_create_a_category_with_parent_should_response_correct_data
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')))
示例11: test_create_a_category_with_exist_category_name_sould_response_status_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)
示例12: test_create_a_category_with_not_enough_data_properties_sould_response_status_400
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)
示例13: test_create_a_category_with_parent_should_response_status_201
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)
示例14: test_create_a_category_with_empty_parent_should_response_status_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)
示例15: test_get_not_exist_category_response_status_404
def test_get_not_exist_category_response_status_404(self):
resp = self.get('/admin/category/1001')
expect(resp.status_int).to_equal(404)