Skip to content

Commit

Permalink
Remove tests for admin
Browse files Browse the repository at this point in the history
  • Loading branch information
amol- committed Mar 4, 2024
1 parent 3939978 commit a4f415b
Showing 1 changed file with 17 additions and 40 deletions.
57 changes: 17 additions & 40 deletions devtools/tests/test_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,6 @@ def test_login(self):
resp = self.app.get('/login')
assert '<h1>Login</h1>' in resp

def test_unauthenticated_admin(self):
assert (
'<h1>Login</h1>' 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,
Expand Down Expand Up @@ -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 (
'<h1>Login</h1>' 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):
Expand All @@ -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 = [
Expand All @@ -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 = [
Expand All @@ -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 = [
Expand All @@ -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):

Expand All @@ -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):

Expand All @@ -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):

Expand All @@ -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'
Expand Down

0 comments on commit a4f415b

Please sign in to comment.