Exemple #1
0
    def test_full__logged_out_before_token_accept(self):

        api_client = Client()

        request_token_url = url('accounts:third-party:tokens:request-authorisation', api_version='1.0', api_client=project_settings.API_CLIENT)

        response = api_client.post(request_token_url, {'application_name': 'app-name',
                                                       'application_info': 'app-info',
                                                       'application_description': 'app-descr'})

        self.check_ajax_ok(response)

        token_url = s11n.from_json(response.content.decode('utf-8'))['data']['authorisation_page']

        token = prototypes.AccessTokenPrototype._db_latest()

        self.assertEqual(url('accounts:third-party:tokens:show', token.uid), token_url)

        self.check_html_ok(self.request_html(token_url), texts=['app-name', 'app-info', 'app-descr'])


        authorisation_state_url = url('accounts:third-party:tokens:authorisation-state', api_version='1.0', api_client=project_settings.API_CLIENT)

        self.check_ajax_ok(api_client.get(authorisation_state_url),
                           data={'account_id': None,
                                 'account_name': None,
                                 'state': relations.AUTHORISATION_STATE.UNPROCESSED.value,
                                 'session_expire_at': 666.6})

        self.check_ajax_ok(api_client.post(logout_url()))

        self.assertNotIn('_auth_user_id', api_client.session)

        self.assertNotEqual(prototypes.AccessTokenPrototype.get_by_uid(token.uid), None)
        self.assertNotIn(third_party_settings.ACCESS_TOKEN_SESSION_KEY, api_client.session)
Exemple #2
0
 def test_logout_command_get(self):
     self.check_redirect(logout_url(), '/')
 def test_logout_command_get(self):
     self.check_redirect(logout_url(), '/')
Exemple #4
0
def logout_url():
    return jinja2.Markup(logic.logout_url())
Exemple #5
0
def logout_url():
    return jinja2.Markup(logic.logout_url())