Пример #1
0
 def test_access_page_via_expired_api_key(self):
     new_api_key = ApiKeyModel().create(base.TEST_USER_ADMIN_LOGIN, 'test')
     Session().commit()
     # patch the API key and make it expired
     new_api_key.expires = 0
     Session().commit()
     self._api_key_test(new_api_key.api_key, status=403)
Пример #2
0
    def test_access_page_via_expired_api_key(self):
        whitelist = self._get_api_whitelist(
            ['ChangesetController:changeset_raw'])
        with mock.patch('kallithea.CONFIG', whitelist):
            assert ['ChangesetController:changeset_raw'
                    ] == whitelist['api_access_controllers_whitelist']

            new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, u'test')
            Session().commit()
            #patch the API key and make it expired
            new_api_key.expires = 0
            Session().commit()
            self._api_key_test(new_api_key.api_key, status=403)
Пример #3
0
    def test_access_page_via_expired_api_key(self):
        whitelist = self._get_api_whitelist(['ChangesetController:changeset_raw'])
        with mock.patch('kallithea.CONFIG', whitelist):
            self.assertEqual(['ChangesetController:changeset_raw'],
                             whitelist['api_access_controllers_whitelist'])

            new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, u'test')
            Session().commit()
            #patch the api key and make it expired
            new_api_key.expires = 0
            Session().add(new_api_key)
            Session().commit()
            with fixture.anon_access(False):
                self.app.get(url(controller='changeset',
                                 action='changeset_raw',
                                 repo_name=HG_REPO, revision='tip',
                                 api_key=new_api_key.api_key),
                             status=302)
Пример #4
0
    def test_access_page_via_expired_api_key(self):
        whitelist = self._get_api_whitelist(
            ['ChangesetController:changeset_raw'])
        with mock.patch('kallithea.CONFIG', whitelist):
            self.assertEqual(['ChangesetController:changeset_raw'],
                             whitelist['api_access_controllers_whitelist'])

            new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, u'test')
            Session().commit()
            #patch the api key and make it expired
            new_api_key.expires = 0
            Session().add(new_api_key)
            Session().commit()
            with fixture.anon_access(False):
                self.app.get(url(controller='changeset',
                                 action='changeset_raw',
                                 repo_name=HG_REPO,
                                 revision='tip',
                                 api_key=new_api_key.api_key),
                             status=302)