Created
October 6, 2017 09:30
-
-
Save elcolie/88eb7c90cfca1c369a020ac232c7fbcc to your computer and use it in GitHub Desktop.
Workable patch by using RESTful
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
def test_mobile_update_customer(self): | |
user = User.objects.create(username='warhead') | |
self.client.force_authenticate(user=user) | |
mommy.make(Customer, family_name='IBM', created_user=self.soken_staff, updated_user=self.soken_staff) | |
data = { | |
"family_name": "C0D1UM" | |
} | |
customer = Customer.objects.first() | |
res = self.client.patch(reverse('api:customer-detail', kwargs={'pk': customer.id}), data=data) | |
self.assertEqual(200, res.status_code) | |
customer.refresh_from_db() | |
self.assertEqual('C0D1UM', customer.family_name) | |
self.assertEqual('spearhead', customer.created_user.username) | |
self.assertEqual('warhead', customer.updated_user.username) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment