Created
November 26, 2013 05:07
-
-
Save buchanae/7653736 to your computer and use it in GitHub Desktop.
Question for django rest framework group regarding fully qualified reverse URL when using APIClient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Album(Model): | |
... | |
class Track(Model): | |
album = ForeignKey(Album) | |
class AlbumSerializer(HyperlinkedModelSerializer): | |
... | |
class TrackTest(APITestCase): | |
def test_track_list(self): | |
response = self.client.get(reverse('tracks-list')) | |
album_url = reverse('album-detail', args=(1,)) | |
expected = [{'album': album_url, ...}] | |
# album_url = '/albums/1' but response.data[0]['album'] is 'http://testserver/albums/1' | |
self.assertEqual(response.data, expected) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment