Skip to content

Commit

Permalink
test page existence view parses correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
easherma committed Jan 12, 2023
1 parent 89fdf70 commit 8974f04
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ def test_get(self):
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'data-wagtail-component="content-import-form"')

class TestCheckUIDView(TestCase):
fixtures = ['test.json']

def setUp(self):
self.client.login(username='admin', password='password')

def test_get(self):
with self.settings(WAGTAILTRANSFER_LOOKUP_FIELDS = {'wagtailcore.page': ['slug', 'locale_id'],}):
# the view should parse comma-seperated params correctly
response = self.client.get('/admin/wagtail-transfer/api/check_uid/?uid=home,1')
self.assertEqual(response.status_code, 200)

@mock.patch('requests.post')
@mock.patch('requests.get')
Expand Down Expand Up @@ -383,6 +394,7 @@ def _test_view(self, method, url, data=None, success_url=None):
with self.subTest(user=user):
self.client.login(username=user.username, password="password")
request = getattr(self.client, method)
breakpoint()
response = request(url, data)
if success_url:
self.assertRedirects(response, success_url)
Expand Down

0 comments on commit 8974f04

Please sign in to comment.