Luis Fernandez
PreguntaHola, espero me puedas ayudar, estoy haciendo un test para probar un response usando este codigo:
def test_user_name_response(self): url = reverse("users:user_name", args=profile.id,) response = self.client.get(url) self.assertEqual(response.status_code, 200)
y la salida que me da es:
url = reverse("users:user_name", args=profile.id,) AttributeError: module 'profile' has no attribute 'id'
Agradezco mucho si me puedes ayudar a solucionar este error, gracias
Luis Fernandez
Gracias!!, aunque me sigue dando el mismo resultado, si piensas que podria ser alguna otra cosa, seria genial, creo que el error esta en "profile", pero no tengo idea que otra cosa escribir, el resultado que me da es:
(venv) λ py manage.py test Found 2 test(s). Creating test database for alias 'default'... System check identified no issues (0 silenced). .E ============================================================ ERROR: test_user_name_response (users.tests.RoomInspectorTes ------------------------------------------------------------ Traceback (most recent call last): File "C:\Users\Luis_Fernandez_DEV\Desktop\Cursos Platzi\Py url = reverse("users:user_name", args=(profile.id,)) AttributeError: module 'profile' has no attribute 'id' ------------------------------------------------------------ Ran 2 tests in 0.407s FAILED (errors=1) Destroying test database for alias 'default'... ```

Moises Alejandro Patiño Hernandez
te falta un par de parentesis deberia ser
def test_user_name_response(self): url = reverse("users:user_name", args=(profile.id,)) response = self.client.get(url) self.assertEqual(response.status_code, 200)