diff --git a/devtools/tests/test_quickstart.py b/devtools/tests/test_quickstart.py index b5185f8..a2636aa 100644 --- a/devtools/tests/test_quickstart.py +++ b/devtools/tests/test_quickstart.py @@ -233,11 +233,6 @@ def test_login(self): resp = self.app.get('/login') assert '

Login

' in resp - def test_unauthenticated_admin(self): - assert ( - '

Login

' in self.app.get('/admin/', status=302).follow() - ) - def test_subtests(self): passed, failed, lines = get_passed_and_failed(self.env_cmd, self.python_cmd, @@ -270,35 +265,40 @@ def test_subtests(self): class CommonTestQuickStartWithAuth(CommonTestQuickStart): - def test_unauthenticated_admin_with_prefix(self): - resp1 = self.app.get('/prefix/admin/', extra_environ={'SCRIPT_NAME': '/prefix'}, status=302) + def test_secured_controller(self): + assert ( + '

Login

' in self.app.get('/secc/', status=302).follow() + ) + + def test_secured_controller_with_prefix(self): + resp1 = self.app.get('/prefix/secc/', extra_environ={'SCRIPT_NAME': '/prefix'}, status=302) assert ( - resp1.headers['Location'] == 'http://localhost/prefix/login?came_from=%2Fprefix%2Fadmin%2F' + resp1.headers['Location'] == 'http://localhost/prefix/login?came_from=%2Fprefix%2Fsecc%2F' ), resp1.headers['Location'] resp2 = resp1.follow(extra_environ={'SCRIPT_NAME': '/prefix'}) assert '/prefix/login_handler' in resp2, resp2 def test_login_with_prefix(self): self.init_database() - resp1 = self.app.post('/prefix/login_handler?came_from=%2Fprefix%2Fadmin%2F', + resp1 = self.app.post('/prefix/login_handler?came_from=%2Fprefix%2Fsecc%2F', params={'login': 'editor', 'password': 'editpass'}, extra_environ={'SCRIPT_NAME': '/prefix'}) assert ( - resp1.headers['Location'] == 'http://localhost/prefix/post_login?came_from=%2Fprefix%2Fadmin%2F' + resp1.headers['Location'] == 'http://localhost/prefix/post_login?came_from=%2Fprefix%2Fsecc%2F' ), resp1.headers['Location'] resp2 = resp1.follow(extra_environ={'SCRIPT_NAME': '/prefix'}) assert ( - resp2.headers['Location'] == 'http://localhost/prefix/admin/' + resp2.headers['Location'] == 'http://localhost/prefix/secc/' ), resp2.headers['Location'] def test_login_failure_with_prefix(self): self.init_database() - resp = self.app.post('/prefix/login_handler?came_from=%2Fprefix%2Fadmin%2F', + resp = self.app.post('/prefix/login_handler?came_from=%2Fprefix%2Fsecc%2F', params={'login': 'WRONG', 'password': 'WRONG'}, extra_environ={'SCRIPT_NAME': '/prefix'}) location = resp.headers['Location'] assert 'http://localhost/prefix/login' in location, location - assert 'came_from=%2Fprefix%2Fadmin%2F' in location, location + assert 'came_from=%2Fprefix%2Fsecc%2F' in location, location class TestDefaultQuickStart(CommonTestQuickStartWithAuth, unittest.TestCase): @@ -313,7 +313,7 @@ def setUp(self): class TestMakoQuickStart(CommonTestQuickStart, unittest.TestCase): - args = '--mako --nosa --noauth --skip-tw' + args = '--mako --nosa --noauth' pass_tests = ['/tests/functional/test_root.'] skip_tests = [ @@ -324,12 +324,9 @@ class TestMakoQuickStart(CommonTestQuickStart, unittest.TestCase): def test_login(self): self.app.get('/login', status=404) - def test_unauthenticated_admin(self): - self.app.get('/admin', status=404) - class TestGenshiQuickStart(CommonTestQuickStart, unittest.TestCase): - args = '--genshi --nosa --noauth --skip-tw' + args = '--genshi --nosa --noauth' pass_tests = ['/tests/functional/test_root.'] skip_tests = [ @@ -340,12 +337,9 @@ class TestGenshiQuickStart(CommonTestQuickStart, unittest.TestCase): def test_login(self): self.app.get('/login', status=404) - def test_unauthenticated_admin(self): - self.app.get('/admin', status=404) - class TestJinjaQuickStart(CommonTestQuickStart, unittest.TestCase): - args = '--jinja --nosa --noauth --skip-tw' + args = '--jinja --nosa --noauth' pass_tests = ['/tests/functional/test_root.'] skip_tests = [ @@ -356,9 +350,6 @@ class TestJinjaQuickStart(CommonTestQuickStart, unittest.TestCase): def test_login(self): self.app.get('/login', status=404) - def test_unauthenticated_admin(self): - self.app.get('/admin', status=404) - class TestNoDBQuickStart(CommonTestQuickStart, unittest.TestCase): @@ -368,14 +359,11 @@ class TestNoDBQuickStart(CommonTestQuickStart, unittest.TestCase): '/tests/functional/test_authentication.', '/tests/models/test_auth.'] - args = '--nosa --noauth --skip-tw' + args = '--nosa --noauth' def test_login(self): self.app.get('/login', status=404) - def test_unauthenticated_admin(self): - self.app.get('/admin', status=404) - class TestNoAuthQuickStart(CommonTestQuickStart, unittest.TestCase): @@ -397,9 +385,6 @@ def setUp(self): def test_login(self): self.app.get('/login', status=404) - def test_unauthenticated_admin(self): - self.app.get('/admin', status=404) - class TestMingBQuickStart(CommonTestQuickStartWithAuth, unittest.TestCase): @@ -414,14 +399,6 @@ def setUp(self): super(TestMingBQuickStart, self).setUp() -class TestNoTWQuickStart(CommonTestQuickStart, unittest.TestCase): - - args = '--skip-tw' - - def test_unauthenticated_admin(self): - self.app.get('/admin', status=404) - - class TestMinimalQuickStart(CommonTestQuickStart, unittest.TestCase): args = '--minimal-quickstart'