Skip to content

Commit 2fce58d

Browse files
Merge pull request #11589 from Vlad0n20/fix/ENG-10272
[ENG-10272] Add tests
2 parents e966ae1 + 5d474ef commit 2fce58d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_auth_views.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,22 @@ def test_logout_with_no_parameter(self):
838838
assert resp.status_code == http_status.HTTP_302_FOUND
839839
assert cas.get_logout_url(self.goodbye_url) == resp.headers['Location']
840840

841+
@mock.patch('framework.auth.views.settings.LOCAL_ANGULAR_URL', 'http://localhost:4200')
842+
def test_logout_with_angular_next_url_logged_in(self):
843+
angular_url = 'http://localhost:4200/'
844+
logout_url = web_url_for('auth_logout', _absolute=True, next=angular_url)
845+
resp = self.app.get(logout_url, auth=self.auth_user.auth)
846+
assert resp.status_code == http_status.HTTP_302_FOUND
847+
assert cas.get_logout_url(logout_url) == resp.headers['Location']
848+
849+
@mock.patch('framework.auth.views.settings.LOCAL_ANGULAR_URL', 'http://localhost:4200')
850+
def test_logout_with_angular_next_url_logged_out(self):
851+
angular_url = 'http://localhost:4200/'
852+
logout_url = web_url_for('auth_logout', _absolute=True, next=angular_url)
853+
resp = self.app.get(logout_url, auth=None)
854+
assert resp.status_code == http_status.HTTP_302_FOUND
855+
assert angular_url == resp.headers['Location']
856+
841857

842858
class TestResetPassword(OsfTestCase):
843859

0 commit comments

Comments
 (0)