MCPcopy Create free account
hub / github.com/lesspass/lesspass / LogInTestCase

Class LogInTestCase

containers/backend/api/tests/test_auth.py:88–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87
88class LogInTestCase(APITestCase):
89 def setUp(self):
90 factories.UserFactory(
91 email="test@example.org",
92 password="test@example.org",
93 )
94
95 def test_login(self):
96 data = {
97 "email": "test@example.org",
98 "password": "test@example.org",
99 }
100 request = self.client.post("/api/auth/jwt/create/", data)
101 self.assertEqual(request.status_code, 200)
102 payload = request.json()
103 self.assertTrue("access" in payload)
104 self.assertTrue("refresh" in payload)
105
106 def test_refresh_token(self):
107 data = {
108 "email": "test@example.org",
109 "password": "test@example.org",
110 }
111 request = self.client.post("/api/auth/jwt/create/", data)
112 self.assertEqual(request.status_code, 200)
113 payload = request.json()
114 refresh_token = payload["refresh"]
115 request = self.client.post("/api/auth/jwt/refresh/", {"refresh": refresh_token})
116 self.assertEqual(request.status_code, 200)
117 payload = request.json()
118 self.assertTrue("access" in payload)
119 self.assertTrue("refresh" in payload)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected