Advertisement
Guest User

Untitled

a guest
Jan 26th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. user_created = User.objects.create_user(first_name="Wally", username="farseer@gmail.com", password="1234",
  2. email="farseer@gmail.com")
  3.  
  4. client_created = Client.objects.create(user=user_created, cart=cart)
  5.  
  6. data_client_profile["user"]["first_name"] = "Apoc"
  7.  
  8. response = self.client.put(reverse("misuper:client_profile"), data_client_profile, format="json")
  9.  
  10. client_created.refresh_from_db() # Tried this too
  11.  
  12. self.assertEqual(response.status_code, status.HTTP_200_OK)
  13.  
  14. self.assertEqual(client_created.user.first_name, data_client_profile["user"]["first_name"])
  15.  
  16. pdb.set_trace()
  17.  
  18. client_existing_user_obj.phone = phone
  19. client_existing_user_obj.user.email = email
  20. client_existing_user_obj.user.first_name = first_name # Updating here!
  21. client_existing_user_obj.user.last_name = last_name
  22. client_existing_user_obj.user.save()
  23. client_existing_user_obj.save()
  24. pdb.set_trace()
  25.  
  26. (Pdb) client_existing_user_obj.user.username
  27. u'farseer@gmail.com' # Make sure I'm updating the created object
  28. (Pdb) client_existing_user_obj.user.first_name
  29. u'Wally' # First name is not updated yet
  30.  
  31. (Pdb) client_existing_user_obj.user.first_name
  32. u'Apoc' # Looks like the first name has being updated!
  33.  
  34. self.assertEqual(client_created.user.first_name, data_client_profile["user"]["first_name"])
  35. AssertionError: 'Wally' != 'Apoc'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement