feat: Confirm a trust bridge
This commit is contained in:
parent
1dfc868345
commit
330e3c89ea
1 changed files with 11 additions and 0 deletions
|
@ -52,3 +52,14 @@ class TrustBridgeTestCase(UserMixin, UserausfallAPITestCase):
|
||||||
self.create_trust_bridge()
|
self.create_trust_bridge()
|
||||||
self.assertEqual(len(mail.outbox), 1)
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
self.assertIn(self.user.trust_bridge.get_confirmation_token(), mail.outbox[0].body)
|
self.assertIn(self.user.trust_bridge.get_confirmation_token(), mail.outbox[0].body)
|
||||||
|
|
||||||
|
def test_confirm_trust_bridge(self):
|
||||||
|
"""The trust giver may confirm the trust bridge."""
|
||||||
|
url = "/trust-bridges/{pk}/confirm/"
|
||||||
|
self.create_trust_bridge()
|
||||||
|
response = self.client.post(
|
||||||
|
self.get_api_url(url, pk=self.trust_bridge.pk), {"token": self.trust_bridge.get_confirmation_token()}
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||||
|
self.trust_bridge.refresh_from_db()
|
||||||
|
self.assertTrue(self.trust_bridge.is_trusted)
|
||||||
|
|
Reference in a new issue