前言:我们学会了告别,却低估了思念

 

使用 assertEqual 断言

import unittest
from utils.config_utils import local_config
from utils  import common_api

class APITest(unittest.TestCase):
    def setUp(self) -> None:
        self.hosts =local_config.hosts
    def tearDown(self) -> None:
        pass

    def test_token(self):
        response01 = common_api.get_access_token('client_credential', 'wx116dfe67cf36b5db', '4fa8e58c98667a8f5cdb1f397d0290d1')
        # self.assertEqual(response01.content.decode('utf-8').__contains__('access_token'), True)      #方法一
        self.assertEqual(response01.json()['expires_in'],7200)         #方法二
if __name__=='__main__': unittest.main()

 

posted on 2020-06-07 15:47  喵小超  阅读(141)  评论(0编辑  收藏  举报