Exemplo n.º 1
0
    def expires(self):
        """Returns the token expiration (as datetime object)

        :returns: datetime

        """
        try:
            return timeutils.parse_isotime(self['access']['token']['expires'])
        except KeyError:
            return None
    def test_building_unscoped(self):
        auth_resp = response.AuthResponse(UNSCOPED_TOKEN)

        self.assertTrue(auth_resp)
        self.assertIn('access', auth_resp)

        self.assertEquals(auth_resp.token,
                          '3e2813b7ba0b4006840c3825860b86ed')
        self.assertEquals(auth_resp.username, 'exampleuser')
        self.assertEquals(auth_resp.user_id,
                          'c4da488862bd435c9e6c0275a0d0e49a')

        self.assertEquals(auth_resp.tenant_name, None)
        self.assertEquals(auth_resp.tenant_id, None)

        self.assertFalse(auth_resp.scoped)

        self.assertEquals(auth_resp.expires, timeutils.parse_isotime(
                          UNSCOPED_TOKEN['access']['token']['expires']))