-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug where the member registration admin view as accessible to any staff member. Added tests for MemberAdmin, RegisterNewMemberAdminView, LInkMembersihpConfirmView (and related classes), LinkAccountTokenGenerator, RegisterMemberForm, LinkedLoginView, LoginForm, RegisterForm,
- Loading branch information
Showing
21 changed files
with
626 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from django.test import TestCase, RequestFactory | ||
from core.views import LinkedLoginView | ||
|
||
class LinkedLoginTestCase(TestCase): | ||
"""Tests for LinkedLoginView""" | ||
|
||
class DummyLinkedLoginView(LinkedLoginView): | ||
"""Linked login with some overrides""" | ||
image_source = "image.png" | ||
image_alt = "Image" | ||
link_title = "Link account" | ||
link_description = "Links account to something" | ||
link_extra = "Some extra info" | ||
|
||
view_class = DummyLinkedLoginView | ||
|
||
def setUp(self) -> None: | ||
self.view = self.view_class() | ||
request_factory = RequestFactory() | ||
self.view.setup(request_factory.get(f"/my_path/")) | ||
|
||
return super().setUp() | ||
|
||
def test_helper_methods(self): | ||
"""Tests helper methods to retrieve class variables""" | ||
self.assertEqual(self.view.get_image_source(), self.view_class.image_source) | ||
self.assertEqual(self.view.get_image_alt(), self.view_class.image_alt) | ||
self.assertEqual(self.view.get_link_title(), self.view_class.link_title) | ||
self.assertEqual(self.view.get_link_description(), self.view_class.link_description) | ||
self.assertEqual(self.view.get_link_extra(), self.view_class.link_extra) | ||
|
||
def test_context(self): | ||
"""Tests if context variables are passed""" | ||
context = self.view.get_context_data() | ||
self.assertIn("image_source", context) | ||
self.assertIn("image_alt", context) | ||
self.assertIn("link_title", context) | ||
self.assertIn("link_description", context) | ||
self.assertIn("link_extra", context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
membership_file/templates/membership_file/testing/registration_email.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
HTML EMAIL! |
Oops, something went wrong.