[Answered ]-IntegrityError: column user_id is not unique in django tastypie test unit

2👍

✅

setUp is run for each of the test_* methods you have. When you comment out the empty test case, setUp is only run once. With the other test_* method not commented out, setUp is run twice, and this is how the uniqueness constraint gets violated.

I would create a tearDown method that deletes the user and api key you created in the other test case.

Leave a comment