Skip to content

Commit 1114aea

Browse files
committed
Remove demo tests
1 parent 1a0c66e commit 1114aea

File tree

2 files changed

+0
-118
lines changed

2 files changed

+0
-118
lines changed

readthedocs/rtd_tests/tests/test_project_views.py

-114
Original file line numberDiff line numberDiff line change
@@ -346,120 +346,6 @@ def test_form_spam_ban_user(self, mocked_validator):
346346
self.assertTrue(self.user.profile.banned)
347347

348348

349-
@mock.patch('readthedocs.projects.views.private.trigger_build', mock.MagicMock())
350-
class TestImportDemoView(TestCase):
351-
"""Test project import demo view."""
352-
353-
fixtures = ['test_data', 'eric']
354-
355-
def setUp(self):
356-
self.client.login(username='eric', password='test')
357-
358-
def test_import_demo_pass(self):
359-
resp = self.client.get('/dashboard/import/manual/demo/')
360-
self.assertEqual(resp.status_code, 302)
361-
self.assertEqual(resp['Location'], '/projects/eric-demo/')
362-
resp_redir = self.client.get(resp['Location'])
363-
self.assertEqual(resp_redir.status_code, 200)
364-
messages = list(resp_redir.context['messages'])
365-
self.assertEqual(messages[0].level, message_const.SUCCESS)
366-
367-
def test_import_demo_already_imported(self):
368-
"""Import demo project multiple times, expect failure 2nd post."""
369-
self.test_import_demo_pass()
370-
project = Project.objects.get(slug='eric-demo')
371-
372-
resp = self.client.get('/dashboard/import/manual/demo/')
373-
self.assertEqual(resp.status_code, 302)
374-
self.assertEqual(resp['Location'], '/projects/eric-demo/')
375-
376-
resp_redir = self.client.get(resp['Location'])
377-
self.assertEqual(resp_redir.status_code, 200)
378-
messages = list(resp_redir.context['messages'])
379-
self.assertEqual(messages[0].level, message_const.SUCCESS)
380-
381-
self.assertEqual(
382-
project,
383-
Project.objects.get(slug='eric-demo'),
384-
)
385-
386-
def test_import_demo_another_user_imported(self):
387-
"""Import demo project after another user, expect success."""
388-
self.test_import_demo_pass()
389-
project = Project.objects.get(slug='eric-demo')
390-
391-
self.client.logout()
392-
self.client.login(username='test', password='test')
393-
resp = self.client.get('/dashboard/import/manual/demo/')
394-
self.assertEqual(resp.status_code, 302)
395-
self.assertEqual(resp['Location'], '/projects/test-demo/')
396-
397-
resp_redir = self.client.get(resp['Location'])
398-
self.assertEqual(resp_redir.status_code, 200)
399-
messages = list(resp_redir.context['messages'])
400-
self.assertEqual(messages[0].level, message_const.SUCCESS)
401-
402-
def test_import_demo_imported_renamed(self):
403-
"""If the demo project is renamed, don't import another."""
404-
self.test_import_demo_pass()
405-
project = Project.objects.get(slug='eric-demo')
406-
project.name = 'eric-demo-foobar'
407-
project.save()
408-
409-
resp = self.client.get('/dashboard/import/manual/demo/')
410-
self.assertEqual(resp.status_code, 302)
411-
self.assertEqual(resp['Location'], '/projects/eric-demo/')
412-
413-
resp_redir = self.client.get(resp['Location'])
414-
self.assertEqual(resp_redir.status_code, 200)
415-
messages = list(resp_redir.context['messages'])
416-
self.assertEqual(messages[0].level, message_const.SUCCESS)
417-
self.assertRegex(
418-
messages[0].message,
419-
r'already imported',
420-
)
421-
422-
self.assertEqual(
423-
project,
424-
Project.objects.get(slug='eric-demo'),
425-
)
426-
427-
def test_import_demo_imported_duplicate(self):
428-
"""
429-
If a project exists with same name, expect a failure importing demo.
430-
431-
This should be edge case, user would have to import a project (not the
432-
demo project), named user-demo, and then manually enter the demo import
433-
URL, as the onboarding isn't shown when projects > 0
434-
"""
435-
self.test_import_demo_pass()
436-
project = Project.objects.get(slug='eric-demo')
437-
project.repo = 'file:///foobar'
438-
project.save()
439-
440-
# Setting the primary and verified email of the test user.
441-
user = User.objects.get(username='eric')
442-
user_email = get(EmailAddress, user=user, primary=True, verified=True)
443-
444-
resp = self.client.get('/dashboard/import/manual/demo/')
445-
self.assertEqual(resp.status_code, 302)
446-
self.assertEqual(resp['Location'], '/dashboard/')
447-
448-
resp_redir = self.client.get(resp['Location'])
449-
self.assertEqual(resp_redir.status_code, 200)
450-
messages = list(resp_redir.context['messages'])
451-
self.assertEqual(messages[0].level, message_const.ERROR)
452-
self.assertRegex(
453-
messages[0].message,
454-
r'There was a problem',
455-
)
456-
457-
self.assertEqual(
458-
project,
459-
Project.objects.get(slug='eric-demo'),
460-
)
461-
462-
463349
@mock.patch('readthedocs.core.utils.trigger_build', mock.MagicMock())
464350
class TestPublicViews(TestCase):
465351
def setUp(self):

readthedocs/rtd_tests/tests/test_views.py

-4
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ def test_import_wizard_manual(self):
8383
response = self.client.get('/dashboard/import/manual/')
8484
self.assertRedirectToLogin(response)
8585

86-
def test_import_wizard_demo(self):
87-
response = self.client.get('/dashboard/import/manual/demo/')
88-
self.assertRedirectToLogin(response)
89-
9086
def test_edit(self):
9187
response = self.client.get('/dashboard/pip/edit/')
9288
self.assertRedirectToLogin(response)

0 commit comments

Comments
 (0)