Skip to content

Instantly share code, notes, and snippets.

@ricomoss
Created November 12, 2015 21:25
Show Gist options
  • Save ricomoss/40fcb7375125ed663e8a to your computer and use it in GitHub Desktop.
Save ricomoss/40fcb7375125ed663e8a to your computer and use it in GitHub Desktop.
from django.test import TestCase, Client
class SomeTestCase(TestCase):
def test_post_success(self):
client = Client()
data = {
'api_key': self.rod_client.api_key,
'username': 'test_user1',
'hero_name': 'test_hero1',
'zone_index': 1,
'stage_index': 1,
'deck_index': 1,
}
resp = client.post(reverse('some:django:namespace'), data)
content = json.loads(resp.content.decode('utf-8'))
self.assertTrue(content['success'])
self.assertIsNotNone(content['data']['results'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment