Last active
December 21, 2015 02:09
-
-
Save ianawilson/6232946 to your computer and use it in GitHub Desktop.
Demonstrating a problem with patching and the Tastypie api client.
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 django.contrib.auth.models import User | |
from tastypie.test import ResourceTestCase | |
class Test(ResourceTestCase): | |
def test_patch(self): | |
user = User(username='username', email='test@test.com') | |
user.set_password('password') | |
user.save() | |
uri = '/api/v1/users/%s' % user.pk | |
data = { | |
'email': 'new@test.com', | |
} | |
response = self.api_client.patch(uri, authentication=self.create_basic('username', 'password'), data=data) | |
self.assertHttpAccepted(response) | |
user = User.objects.get(pk=user.pk) | |
self.assertEqual(user.email, 'new@test.com') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment