Skip to content

Commit

Permalink
fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
bansalnitish committed Apr 17, 2018
1 parent dacf27f commit 8fdf569
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
22 changes: 22 additions & 0 deletions readthedocs/rtd_tests/tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,25 @@ def test_version_url_with_caps(self):
kwargs={'type_': 'pdf', 'version_slug': u'1.4.X', 'project_slug': u'django'}
)
self.assertTrue(url)


class TestProfileDetailURLs(TestCase):

def test_profile_detail_url(self):
url = reverse(
'profiles_profile_detail',
kwargs={'username': 'foo+bar'}
)
self.assertEqual(url, '/profiles/foo+bar/')

url = reverse(
'profiles_profile_detail',
kwargs={'username': '[email protected]'}
)
self.assertEqual(url, '/profiles/[email protected]/')

url = reverse(
'profiles_profile_detail',
kwargs={'username': 'abc-def+ghi'}
)
self.assertEqual(url, '/profiles/abc-def+ghi/')
27 changes: 0 additions & 27 deletions readthedocs/rtd_tests/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,30 +241,3 @@ def test_project_admins_can_delete_subprojects_that_they_are_not_admin_of(self):
'/dashboard/my-mainproject/subprojects/my-subproject/delete/')
self.assertEqual(response.status_code, 302)
self.assertTrue(self.subproject not in [r.child for r in self.project.subprojects.all()])

class URLResolution(TestCase):
def setUp(self):
self.user1 = new(User, username='foo+bar')
self.user1.set_password('test1')
self.user1.save()

self.user2 = new(User, username='[email protected]')
self.user2.set_password('test2')
self.user2.save()

self.user3 = new(User, username='abc-def+ghi')
self.user3.set_password('test3')
self.user3.save()

self.client.login(username='foo+bar', password='test1')

def test_profile_details_page(self):

response = self.client.get('/profiles/foo+bar/')
self.assertEqual(response.status_code, 200)

response = self.client.get('/profiles/[email protected]/')
self.assertEqual(response.status_code, 200)

response = self.client.get('/profiles/abc-def+ghi/')
self.assertEqual(response.status_code, 200)

0 comments on commit 8fdf569

Please sign in to comment.