title: Django REST API test returns HTTP_200_OK when requesting users-list but HTTP_404_NOT_FOUND for users-details
body: <p>I'm trying to write tests for a UserViewSet:</p>
  
  <p><strong>users.models.py</strong></p>
  
  <p><code>class User(AbstractUser):</code></p>
  
  <p><strong>users.serializers.py</strong></p>
  
  <pre><code>class UserSerializer(serializers.ModelSerializer):
  
      email = serializers.EmailField(
              write_only=True,
              required=True,
              min_length=8,
              validators=[UniqueValidator(queryset=User.objects.all())]
              )
  
      username = serializers.CharField(
              max_length=32,
              required=True,
              validators=[UniqueValidator(queryset=User.objects.all())]
              )
  
      class Meta:
          model = User
          fields = (
              'id',
              'first_name',
              'last_name',
              'username',
              'password',
              'email',
          )
  
          extra_kwargs = {
              'password': {'write_only': True, 'min_length':8,'required':True},
          }
  </code></pre>
  
  <p><strong>users.views.py</strong></p>
  
  <pre><code>class UserViewSet(viewsets.ModelViewSet):
      queryset = User.objects.all()
      serializer_class = serializers.UserSerializer
      permission_classes = [permissions.IsAuthenticated]
  </code></pre>
  
  <p><strong>users.tests.py</strong></p>
  
  <pre><code>def setup_user(username='test_user', email='test_user@test.com',password='test_password'):
      test_user = User.objects.create_user(username=username, email=email,password=password)
      test_user.save()
      return test_user
  
  class UserTest(APITestCase):
      def setUp(self):
          self.test_user = setup_user()
          self.test_user2 = setup_user(username='test_user2', email='test_user2@test.com',password='test_password2')
  
      # test the /users/ endpoint
      def test_authenticated_user_can_get_users_list(self):
          self.client.force_authenticate(user=self.test_user)
          response = self.client.get(reverse('users-list'), format='json')
          self.assertEqual(response.status_code,status.HTTP_200_OK)
  
  
      def test_authenticated_user_can_get_users_detail(self):
          self.client.force_authenticate(user=self.test_user)
          user_detail_url = reverse('users-detail', args=(1,))
          print(user_detail_url)
          response = self.client.get(user_detail_url, format='json')
          print(response)
  </code></pre>
  
  <p>The first test runs fine and returns a  <em>HTTP_200_OK</em> status code as I expect. However the response for the detail view returns a <em>HTTP_404_NOT_FOUND</em> which I don't understand since everything seems to work fine outside of this test:</p>
  
  <p>If I run <code>python manage.py runserver</code> and check the <strong>/api/users/:id/</strong> endpoint everything works as expected and the corresponding user is correctly serialized. Same if I use <strong>requests</strong> and request any user details:</p>
  
  <pre><code>r = requests.get('{}/users/2/'.format(api_root),  headers={'Authorization': 'Token {}'.format(get_token())})
  </code></pre>
  
  <p>(and yeah I'm using Token Authentication) I see all the fields I expect to see in <code>r.json():</code></p>
  
  <p>id, first_name, last_name and username</p>
  
  <p>thanks for your help!</p>