Пример #1
0
    def test_get_token(self):
        """An identity token can be gotten from a OTPPrincipal.

        The token returned is that of the stored credentials, not
        the serialized one time password principal.
        """
        self.set_otp_test_ace()

        principal = OTPPrincipal(self.client)
        yield principal.create("foobar", "secret")
        self.assertEqual(principal.get_token(), make_identity("foobar:secret"))
        self.assertEqual(principal.name, "foobar")
Пример #2
0
    def test_get_token(self):
        """An identity token can be gotten from a OTPPrincipal.

        The token returned is that of the stored credentials, not
        the serialized one time password principal.
        """
        self.set_otp_test_ace()

        principal = OTPPrincipal(self.client)
        yield principal.create("foobar", "secret")
        self.assertEqual(principal.get_token(),
                         make_identity("foobar:secret"))
        self.assertEqual(principal.name, "foobar")
Пример #3
0
    def test_serialize(self):
        """The principal can be serialized to just the OTP data."""
        self.set_otp_test_ace()

        principal = OTPPrincipal(self.client)
        yield principal.create("foobar", "secret")

        otp_data = principal.serialize()
        path, user, password = base64.b64decode(otp_data).split(":")
        acl, stat = yield self.client.get_acl(path)

        self.assertEqual(principal.get_token(), make_identity("foobar:secret"))
        self.assertEqual(principal.name, "foobar")
Пример #4
0
    def test_serialize(self):
        """The principal can be serialized to just the OTP data."""
        self.set_otp_test_ace()

        principal = OTPPrincipal(self.client)
        yield principal.create("foobar", "secret")

        otp_data = principal.serialize()
        path, user, password = base64.b64decode(otp_data).split(":")
        acl, stat = yield self.client.get_acl(path)

        self.assertEqual(principal.get_token(),
                         make_identity("foobar:secret"))
        self.assertEqual(principal.name, "foobar")