mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Refactor schemas tests style
This commit is contained in:
parent
8fcb8d6350
commit
401ab54275
|
@ -90,7 +90,7 @@ class TestRouterGeneratedSchema(TestCase):
|
||||||
def test_anonymous_request(self):
|
def test_anonymous_request(self):
|
||||||
client = APIClient()
|
client = APIClient()
|
||||||
response = client.get('/', HTTP_ACCEPT='application/coreapi+json')
|
response = client.get('/', HTTP_ACCEPT='application/coreapi+json')
|
||||||
self.assertEqual(response.status_code, 200)
|
assert response.status_code == 200
|
||||||
expected = coreapi.Document(
|
expected = coreapi.Document(
|
||||||
url='',
|
url='',
|
||||||
title='Example API',
|
title='Example API',
|
||||||
|
@ -125,13 +125,13 @@ class TestRouterGeneratedSchema(TestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.assertEqual(response.data, expected)
|
assert response.data == expected
|
||||||
|
|
||||||
def test_authenticated_request(self):
|
def test_authenticated_request(self):
|
||||||
client = APIClient()
|
client = APIClient()
|
||||||
client.force_authenticate(MockUser())
|
client.force_authenticate(MockUser())
|
||||||
response = client.get('/', HTTP_ACCEPT='application/coreapi+json')
|
response = client.get('/', HTTP_ACCEPT='application/coreapi+json')
|
||||||
self.assertEqual(response.status_code, 200)
|
assert response.status_code == 200
|
||||||
expected = coreapi.Document(
|
expected = coreapi.Document(
|
||||||
url='',
|
url='',
|
||||||
title='Example API',
|
title='Example API',
|
||||||
|
@ -217,7 +217,7 @@ class TestRouterGeneratedSchema(TestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.assertEqual(response.data, expected)
|
assert response.data == expected
|
||||||
|
|
||||||
|
|
||||||
class DenyAllUsingHttp404(permissions.BasePermission):
|
class DenyAllUsingHttp404(permissions.BasePermission):
|
||||||
|
@ -312,7 +312,7 @@ class TestSchemaGenerator(TestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.assertEqual(schema, expected)
|
assert schema == expected
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(coreapi, 'coreapi is not installed')
|
@unittest.skipUnless(coreapi, 'coreapi is not installed')
|
||||||
|
@ -365,7 +365,7 @@ class TestSchemaGeneratorNotAtRoot(TestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.assertEqual(schema, expected)
|
assert schema == expected
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(coreapi, 'coreapi is not installed')
|
@unittest.skipUnless(coreapi, 'coreapi is not installed')
|
||||||
|
@ -400,7 +400,7 @@ class TestSchemaGeneratorWithRestrictedViewSets(TestCase):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.assertEqual(schema, expected)
|
assert schema == expected
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(coreapi, 'coreapi is not installed')
|
@unittest.skipUnless(coreapi, 'coreapi is not installed')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user