def test_post_user_when_id_invalid_should_not_create_user_and_reply_400(self):
    initial_users_count = len(self.users)
    invalid_data = {'first_name': 'Casper', 'last_name': 'Canterville', 'email': '', 'password': 'dummy'}
    request = self.factory.post(reverse('v1:user-list'), data=invalid_data, REMOTE_ADDR='0.0.0.0')
    user_detail_view = UserViewSet.as_view({'post': 'create'})
    response = user_detail_view(request)
    self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code)
    users_count = User.objects.count()
    self.assertEqual(initial_users_count, users_count)
def test_post_user_when_id_invalid_should_not_create_user_and_reply_400(self):
    initial_users_count = len(self.users)
    invalid_data = {'first_name': 'Casper', 'last_name': 'Canterville', 'email': , 'password': 'dummy'}
    request = self.factory.post(reverse('v1:user-list'), data=invalid_data, REMOTE_ADDR='0.0.0.0')
    user_detail_view = UserViewSet.as_view({'post': 'create'})
    response = user_detail_view(request)
    self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code)
    users_count = User.objects.count()
    self.assertEqual(initial_users_count, users_count)