def test_tags_list(self, session_4):
     # 获取企业标签库
     r = self.wework.get_corp_tag_list(session_4)
     assert r.status_code == 200
     utils.print_json(r)
     assert r.json()['errcode'] == 0
     assert len(r.json()['tag_group']) > 0
    def test_add_corp_tag(self, session_4):
        # 方法一:加上时间戳保证测试数据的唯一性
        # 方法二:维护可重复使用的测试数据
        # group_name = 'group_普通客户'
        # tag_name = 'name_砖石'
        # r = self.wework.add_corp_tag(group_name,tag_name)

        group_name = 'group_普通客户11111'
        tag_name = 'name_砖石1111111'
        r = self.wework.add_corp_tag(session_4, group_name, tag_name)

        utils.print_json(r)
        assert r.json()['errcode'] == 0
示例#3
0
    def test_add_corp_tag(self, access_token_3):
        # 方法一:加上时间戳保证测试数据的唯一性
        # 方法二:维护可重复使用的测试数据
        # group_name = 'group_普通客户'
        # tag_name = 'name_砖石'
        # r = self.wework.add_corp_tag(group_name,tag_name)

        group_name = 'group_普通客户2222'
        tag_name = 'name_砖石22222'
        r = self.wework.add_corp_tag(group_name, tag_name, access_token_3)

        utils.print_json(r)
        assert r.json()['errcode'] == 0
示例#4
0
    def test_del_corp_tag(self, group_name, tag_name):
        # 先添加一个标签
        r = self.wework.add_corp_tag(group_name, tag_name)

        # 添加之后获取tag_id
        tag_id = self.wework.get_group_tag_id_by_name(tag_name=tag_name)
        utils.print_json(r)

        # 添加完成之后需要断言是否添加成功
        assert tag_id != None

        # 删除指定tag_id的标签
        r = self.wework.del_corp_tag(tag_id=tag_id)

        # 删除之后获取tag_id
        tag_id = self.wework.get_group_tag_id_by_name(tag_name=tag_name)

        utils.print_json(r)

        # 删除成功之后断言
        assert r.json()['errcode'] == 0
        assert tag_id == None
示例#5
0
 def test_cookies2(self):
     url = 'http://httpbin.testing-studio.com/cookies'
     headers = {'User-Agent': 'echo'}
     cookies = {'cookie1': 'echo1', 'cookies2': 'echo2'}
     r = requests.get(url=url, headers=headers, cookies=cookies)
     utils.print_json(r)
示例#6
0
 def test_cookies1(self):
     url = 'http://httpbin.testing-studio.com/cookies'
     headers = {'Cookie': 'echo'}
     r = requests.get(url=url, headers=headers)
     utils.print_json(r)
示例#7
0
 def test_hamcrest(self):
     r = requests.get('https://ceshiren.com/categories.json')
     utils.print_json(r)
     assert_that(r.json()['category_list']['categories'][1]['name'],
                 equal_to('开源项目'))
     assert_that(jsonpath(r.json(), '$..name')[1], equal_to('开源项目'))
示例#8
0
 def test_hog_json(self):
     r = requests.get('https://ceshiren.com/categories.json')
     utils.print_json(r)
     assert r.json()['category_list']['categories'][1]['name'] == '开源项目'
     assert jsonpath(r.json(), '$..name')[1] == '开源项目'