-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from ngenworks/sideload-resources
Allow developers to opt out of having the root JSON key automatically added
- Loading branch information
Showing
6 changed files
with
101 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" | ||
Test sideloading resources | ||
""" | ||
import json | ||
from example.tests import TestBase | ||
from django.core.urlresolvers import reverse_lazy | ||
from django.conf import settings | ||
|
||
|
||
class SideloadResourceTest(TestBase): | ||
""" | ||
Test that sideloading resources returns expected output. | ||
""" | ||
url = reverse_lazy('users-cars') | ||
|
||
def test_get_sideloaded_data(self): | ||
""" | ||
Ensure resources that are meant for sideloaded data | ||
do not return a single root key. | ||
""" | ||
response = self.client.get(self.url) | ||
content = json.loads(response.content) | ||
|
||
self.assertEqual(content.keys(), ['cars', 'users']) | ||
|
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
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