Beispiel #1
0
 def test_logout(self, url, username, password, expect_code, expect_msg,
                 expect_headers):
     ApiLogin().api_login_post(url, username, password)
     self.logout = ApiLogout().Api_logout_post(url=api.logout_url)
     assert self.logout.status_code == expect_code
     assert self.logout.json() == expect_msg
     assert expect_headers in self.logout.headers['Set-Cookie']
Beispiel #2
0
 def teardown_class(cls):
     GetSession().get_session().post(
         api.fb_url,
         json={
             "action":
             "set",
             "name":
             "homepage",
             "value":
             "{\"news\":[5,7,6,3,4],\"notice\":[1,3,5,2]"
             ",\"paper\":[5,9,10,4,8]}"
         },
         headers={'Content-Type': 'application/json'})
     ApiLogout().Api_logout_post(url=api.logout_url)
     GetSession().clear_session()
Beispiel #3
0
class TestLogout:
    @classmethod
    def setup_class(cls):
        pass

    @classmethod
    def teardown_class(cls):
        GetSession.clear_session()

    @pytest.mark.parametrize(
        'url, username, password,expect_code,expect_msg,expect_headers',
        read_yaml('logout_prepare.yaml'))
    def test_logout(self, url, username, password, expect_code, expect_msg,
                    expect_headers):
        ApiLogin().api_login_post(url, username, password)
        self.logout = ApiLogout().Api_logout_post(url=api.logout_url)
        assert self.logout.status_code == expect_code
        assert self.logout.json() == expect_msg
        assert expect_headers in self.logout.headers['Set-Cookie']
Beispiel #4
0
 def teardown_class(cls):
     ApiLogout().Api_logout_post(url=api.logout_url)
     GetSession().clear_session()
Beispiel #5
0
 def teardown_class(cls):
     ApiSetInfo().api_set_info(name='学员1', url=api.info_url)
     ApiLogout().Api_logout_post(url=api.logout_url)
     GetSession().clear_session()