mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 21:10:13 +03:00
converted asserts of browsable_api test to pytest
This commit is contained in:
parent
22578525ef
commit
7246097818
|
@ -26,16 +26,16 @@ class DropdownWithAuthTests(TestCase):
|
|||
def test_name_shown_when_logged_in(self):
|
||||
self.client.login(username=self.username, password=self.password)
|
||||
response = self.client.get('/')
|
||||
self.assertContains(response, 'john')
|
||||
assert 'john' in response
|
||||
|
||||
def test_logout_shown_when_logged_in(self):
|
||||
self.client.login(username=self.username, password=self.password)
|
||||
response = self.client.get('/')
|
||||
self.assertContains(response, '>Log out<')
|
||||
assert '>Log out<' in response
|
||||
|
||||
def test_login_shown_when_logged_out(self):
|
||||
response = self.client.get('/')
|
||||
self.assertContains(response, '>Log in<')
|
||||
assert '>Log in<' in response
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='tests.browsable_api.no_auth_urls')
|
||||
|
@ -58,13 +58,13 @@ class NoDropdownWithoutAuthTests(TestCase):
|
|||
def test_name_shown_when_logged_in(self):
|
||||
self.client.login(username=self.username, password=self.password)
|
||||
response = self.client.get('/')
|
||||
self.assertContains(response, 'john')
|
||||
assert 'john' in response
|
||||
|
||||
def test_dropdown_not_shown_when_logged_in(self):
|
||||
self.client.login(username=self.username, password=self.password)
|
||||
response = self.client.get('/')
|
||||
self.assertNotContains(response, '<li class="dropdown">')
|
||||
assert '<li class="dropdown">' not in response
|
||||
|
||||
def test_dropdown_not_shown_when_logged_out(self):
|
||||
response = self.client.get('/')
|
||||
self.assertNotContains(response, '<li class="dropdown">')
|
||||
assert '<li class="dropdown">' not in response
|
||||
|
|
Loading…
Reference in New Issue
Block a user