Commit c7171bb3 authored by Valentin Samir's avatar Valentin Samir

Add a test for login with missing parameter (username or password or both)

parent 58be6fb3
Pipeline #598 failed with stage
in 7 minutes and 51 seconds
......@@ -132,6 +132,37 @@ class LoginTestCase(TestCase, BaseServicePattern, CanLogin):
# The LoginTicket is conssumed and should no longer be valid
self.assertTrue(params['lt'] not in client.session['lt'])
def test_login_post_missing_params(self):
"""Test a login attempt with missing POST parameters (username or password or both)"""
# we get a client who fetch a frist time the login page and the login form default
# parameters
client, params = get_login_page_params()
# we set only set username
params["username"] = settings.CAS_TEST_USER
# we post a login attempt
response = client.post('/login', params)
# as the LT is not valid, login should fail
self.assert_login_failed(client, response)
# we get a client who fetch a frist time the login page and the login form default
# parameters
client, params = get_login_page_params()
# we set only set password
params["password"] = settings.CAS_TEST_PASSWORD
# we post a login attempt
response = client.post('/login', params)
# as the LT is not valid, login should fail
self.assert_login_failed(client, response)
# we get a client who fetch a frist time the login page and the login form default
# parameters
client, params = get_login_page_params()
# we set neither username nor password
# we post a login attempt
response = client.post('/login', params)
# as the LT is not valid, login should fail
self.assert_login_failed(client, response)
def test_login_view_post_goodpass_goodlt_warn(self):
"""Test a successul login requesting to be warned before creating services tickets"""
# get a client and initial login params
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment