Created
July 2, 2015 13:31
-
-
Save komuw/2602693775ed97461404 to your computer and use it in GitHub Desktop.
test xml in django/ rest framework
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
from rest_framework.test import APIClient | |
class SomeTests(LiveServerTestCase): | |
def setUp(self): | |
self.real_URL = settings.SOME_URL | |
settings.SOME_URL = '{0}/some-url/'.format(self.live_server_url) | |
self.client = APIClient() | |
self.payload = """<some>xml-string</xml>""" | |
def tearDown(self): | |
settings.SOME_URL = self.real_URL | |
def test_something(self): | |
response = self.client.post(reverse('view_name'), data=self.payload, content_type='application/xml') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment