def test_new_requires_private_key(self):
        self.be_admin_user()
        PrivateKey.get_by_key_name("singleton").delete()

        response = self.testapp.get("/packages/test-package/versions/new")
        self.assertEqual(response.status_int, 302)
        self.assertEqual(response.headers["Location"], "http://localhost:80/admin#tab-private-key")
    def test_new_requires_private_key(self):
        self.be_admin_oauth_user()
        PrivateKey.get_by_key_name('singleton').delete()

        response = self.testapp.get('/packages/test-package/versions/new.json',
                                    status=500)
        self.assert_json_error(response)
Exemplo n.º 3
0
    def test_api_new_requires_oauth_key(self):
        self.be_admin_oauth_user()
        PrivateKey.get_by_key_name('singleton').delete()

        response = self.testapp.get('/api/packages/versions/new',
                                    status=500)
        self.assert_json_error(response)
Exemplo n.º 4
0
    def test_api_dartdoc_requires_private_key(self):
        self.be_admin_oauth_user()
        self.post_package_version('1.2.3')
        PrivateKey.get_by_key_name('singleton').delete()

        response = self.testapp.get(
            '/api/packages/test-package/versions/1.2.3/new_dartdoc',
            status=500)
        self.assert_json_error(response)
Exemplo n.º 5
0
    def test_api_dartdoc_requires_oauth_key(self):
        self.be_admin_oauth_user()
        self.post_package_version('1.2.3')
        PrivateKey.get_by_key_name('singleton').delete()

        response = self.testapp.get(
            '/api/packages/test-package/versions/1.2.3/new_dartdoc',
            status=500)
        self.assert_json_error(response)
Exemplo n.º 6
0
    def test_index_requires_api_key(self):
        self.be_admin_oauth_user()
        PrivateKey.get_by_key_name('api').delete()

        response = self.testapp.get('/search?q=query', status=500)
        self.assert_error_page(response)
Exemplo n.º 7
0
    def test_index_requires_api_key(self):
        self.be_admin_oauth_user()
        PrivateKey.get_by_key_name('api').delete()

        response = self.testapp.get('/search?q=query', status=500)
        self.assert_error_page(response)