-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
38 additions
and
116 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
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
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
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
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 |
---|---|---|
|
@@ -8,9 +8,7 @@ class AdminListViewTestCase(AppTestCase): | |
fixtures = ["test.json"] | ||
|
||
def setUp(self): | ||
self.user = User.objects.create_user( | ||
"user", "[email protected]", "password", is_staff=True | ||
) | ||
self.user = User.objects.create_user("user", "[email protected]", "password", is_staff=True) | ||
self.access_admin = Permission.objects.get(codename="access_admin") | ||
self.add_perm = Permission.objects.get(codename="add_form") | ||
self.change_perm = Permission.objects.get(codename="change_form") | ||
|
@@ -35,9 +33,7 @@ def test_copy_button_uses_add_perm(self): | |
self.assertEqual(response.status_code, 200) | ||
self.assertIn('title="Copy this form">Copy</a>', str(response.content)) | ||
|
||
@override_settings( | ||
WAGTAILSTREAMFORMS_ADVANCED_SETTINGS_MODEL="tests.ValidFormSettingsModel" | ||
) | ||
@override_settings(WAGTAILSTREAMFORMS_ADVANCED_SETTINGS_MODEL="tests.ValidFormSettingsModel") | ||
def test_advanced_button_enabled_when_setup(self): | ||
url = "/cms/wagtailstreamforms/form/" | ||
expected_html = 'title="Advanced settings">Advanced</a>' | ||
|
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 |
---|---|---|
|
@@ -15,12 +15,8 @@ def setUp(self): | |
User.objects.create_superuser("user", "[email protected]", "password") | ||
self.form = Form.objects.get(pk=1) | ||
|
||
self.copy_url = reverse( | ||
"wagtailstreamforms:streamforms_copy", kwargs={"pk": self.form.pk} | ||
) | ||
self.invalid_copy_url = reverse( | ||
"wagtailstreamforms:streamforms_copy", kwargs={"pk": 100} | ||
) | ||
self.copy_url = reverse("wagtailstreamforms:streamforms_copy", kwargs={"pk": self.form.pk}) | ||
self.invalid_copy_url = reverse("wagtailstreamforms:streamforms_copy", kwargs={"pk": 100}) | ||
|
||
self.client.login(username="user", password="password") | ||
|
||
|
@@ -49,9 +45,7 @@ def test_post_copies(self): | |
self.assertEqual(Form.objects.count(), 2) | ||
|
||
def test_post_redirects(self): | ||
response = self.client.post( | ||
self.copy_url, data={"title": "new copy", "slug": "new-slug"} | ||
) | ||
response = self.client.post(self.copy_url, data={"title": "new copy", "slug": "new-slug"}) | ||
url_helper = FormURLHelper(model=Form) | ||
self.assertRedirects(response, url_helper.index_url) | ||
|
||
|
@@ -62,16 +56,12 @@ class CopyViewPermissionTestCase(AppTestCase): | |
def setUp(self): | ||
self.user = User.objects.create_user("user", "[email protected]", "password") | ||
form = Form.objects.get(pk=1) | ||
self.copy_url = reverse( | ||
"wagtailstreamforms:streamforms_copy", kwargs={"pk": form.pk} | ||
) | ||
self.copy_url = reverse("wagtailstreamforms:streamforms_copy", kwargs={"pk": form.pk}) | ||
|
||
def test_no_user_no_access(self): | ||
response = self.client.get(self.copy_url) | ||
self.assertEqual(response.status_code, 302) | ||
self.assertTrue( | ||
response.url.startswith("/cms/login/?next=/cms/wagtailstreamforms") | ||
) | ||
self.assertTrue(response.url.startswith("/cms/login/?next=/cms/wagtailstreamforms")) | ||
|
||
def test_user_with_no_perm_no_access(self): | ||
access_admin = Permission.objects.get(codename="access_admin") | ||
|
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 |
---|---|---|
|
@@ -75,9 +75,7 @@ def setUp(self): | |
self.user = User.objects.create_user("user", "[email protected]", "password") | ||
|
||
self.form = Form.objects.get(pk=1) | ||
self.form_submission = FormSubmission.objects.create( | ||
form=self.form, form_data="{}" | ||
) | ||
self.form_submission = FormSubmission.objects.create(form=self.form, form_data="{}") | ||
|
||
self.delete_url = "{}?selected-submissions={}".format( | ||
reverse( | ||
|
@@ -90,9 +88,7 @@ def setUp(self): | |
def test_no_user_no_access(self): | ||
response = self.client.get(self.delete_url) | ||
self.assertEqual(response.status_code, 302) | ||
self.assertTrue( | ||
response.url.startswith("/cms/login/?next=/cms/wagtailstreamforms") | ||
) | ||
self.assertTrue(response.url.startswith("/cms/login/?next=/cms/wagtailstreamforms")) | ||
|
||
def test_user_with_no_perm_no_access(self): | ||
access_admin = Permission.objects.get(codename="access_admin") | ||
|
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