def test_create_valid_user_successful(self):
    'Test creating user with valid payload is successful'
    payload = {'email': 'example@example.com', 'password': 'testpass', 'name': 'John Doe'}
    res = self.client.post(CREATE_USER_URL, payload)
    self.assertEqual(res.status_code, status.HTTP_201_CREATED)
    user = get_user_model().objects.get(**res.data)
    self.assertTrue(user.check_password(payload['password']))
    self.assertNotIn('password', res.data)
Test creating user with valid payload is successful
def test_create_valid_user_successful(self):
    
    payload = {'email': 'example@example.com', 'password': 'testpass', 'name': 'John Doe'}
    res = self.client.post(CREATE_USER_URL, payload)
    self.assertEqual(res.status_code, status.HTTP_201_CREATED)
    user = get_user_model().objects.get(**res.data)
    self.assertTrue(user.check_password(payload['password']))
    self.assertNotIn('password', res.data)