[Answered ]-Urls with name are not accessible in Django Client Tests (NoReverseMatch error)

2👍

I was able to resolve my errors by putting urls in my test case like this

class MyTests(APITestCase):

    urls = 'my_app.urls'        

    def test_01(self):
        url = reverse('login')
        data = {'username': 'username', 'password': 'StrongPassword'}
        response = self.client.post(url, data)
        self.assertEqual(response.data, my_expected_output)

Leave a comment