feat: Confirm a trust bridge

This commit is contained in:
aldrin 2021-10-22 11:48:44 +02:00
parent 1dfc868345
commit 330e3c89ea

View file

@ -52,3 +52,14 @@ class TrustBridgeTestCase(UserMixin, UserausfallAPITestCase):
self.create_trust_bridge()
self.assertEqual(len(mail.outbox), 1)
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)