Exemplo n.º 1
0
 def assertValidISO8601ExtendedFormatDatetime(self, dt):
     try:
         return timeutils.parse_strtime(dt, fmt=TIME_FORMAT)
     except Exception:
         msg = '%s is not a valid ISO 8601 extended format date time.' % dt
         raise AssertionError(msg)
     self.assertIsInstance(dt, datetime.datetime)
Exemplo n.º 2
0
 def assertValidISO8601ExtendedFormatDatetime(self, dt):
     try:
         return timeutils.parse_strtime(dt, fmt=TIME_FORMAT)
     except Exception:
         msg = '%s is not a valid ISO 8601 extended format date time.' % dt
         raise AssertionError(msg)
     self.assertTrue(isinstance(dt, datetime.datetime))
Exemplo n.º 3
0
    def test_create_trust(self):
        self.assertEquals(self.new_trust["trustor_user_id"], self.trustor["id"])
        self.assertEquals(self.new_trust["trustee_user_id"], self.trustee["id"])
        role_ids = [self.role_browser["id"], self.role_member["id"]]
        self.assertTrue(timeutils.parse_strtime(self.new_trust["expires_at"], fmt=TIME_FORMAT))

        for role in self.new_trust["roles"]:
            self.assertIn(role["id"], role_ids)
Exemplo n.º 4
0
    def test_create_trust(self):
        self.assertEqual(self.new_trust["trustor_user_id"], self.trustor["id"])
        self.assertEqual(self.new_trust["trustee_user_id"], self.trustee["id"])
        role_ids = [self.role_browser["id"], self.role_member["id"]]
        self.assertTrue(timeutils.parse_strtime(self.new_trust["expires_at"], fmt=TIME_FORMAT))
        self.assertIn("http://localhost:5000/v3/OS-TRUST/", self.new_trust["links"]["self"])
        self.assertIn("http://localhost:5000/v3/OS-TRUST/", self.new_trust["roles_links"]["self"])

        for role in self.new_trust["roles"]:
            self.assertIn(role["id"], role_ids)
Exemplo n.º 5
0
    def test_create_trust(self):
        self.assertEquals(self.new_trust['trustor_user_id'],
                          self.trustor['id'])
        self.assertEquals(self.new_trust['trustee_user_id'],
                          self.trustee['id'])
        role_ids = [self.role_browser['id'], self.role_member['id']]
        self.assertTrue(timeutils.parse_strtime(self.new_trust['expires_at'],
                                                fmt=TIME_FORMAT))

        for role in self.new_trust['roles']:
            self.assertIn(role['id'], role_ids)
Exemplo n.º 6
0
    def test_create_trust(self):
        self.assertEqual(self.trustor['id'], self.new_trust['trustor_user_id'])
        self.assertEqual(self.trustee['id'], self.new_trust['trustee_user_id'])
        role_ids = [self.role_browser['id'], self.role_member['id']]
        self.assertTrue(timeutils.parse_strtime(self.new_trust['expires_at'],
                                                fmt=TIME_FORMAT))
        self.assertIn('%s/v3/OS-TRUST/' % HOST_URL,
                      self.new_trust['links']['self'])
        self.assertIn('%s/v3/OS-TRUST/' % HOST_URL,
                      self.new_trust['roles_links']['self'])

        for role in self.new_trust['roles']:
            self.assertIn(role['id'], role_ids)
Exemplo n.º 7
0
    def test_create_trust(self):
        self.assertEqual(self.new_trust['trustor_user_id'], self.trustor['id'])
        self.assertEqual(self.new_trust['trustee_user_id'], self.trustee['id'])
        role_ids = [self.role_browser['id'], self.role_member['id']]
        self.assertTrue(timeutils.parse_strtime(self.new_trust['expires_at'],
                                                fmt=TIME_FORMAT))
        self.assertIn('http://localhost:5000/v3/OS-TRUST/',
                      self.new_trust['links']['self'])
        self.assertIn('http://localhost:5000/v3/OS-TRUST/',
                      self.new_trust['roles_links']['self'])

        for role in self.new_trust['roles']:
            self.assertIn(role['id'], role_ids)
 def create_user(self, context, user):
     ref = self._assign_unique_id(self._normalize_dict(user))
     user_id = user.get('id', None)
     if user_id is not None:
         ref['id'] = user_id
     expires = user.get('expires', None)
     if expires is not None:
         try:
             ref['expires'] = timeutils.parse_strtime(expires)
         except ValueError:
             ref['expires'] = timeutils.parse_isotime(expires)
     ref = self._normalize_domain_id(context, ref)
     ref = self.identity_api.create_user(context, ref['id'], ref)
     return UserV3.wrap_member(context, ref)
Exemplo n.º 9
0
    def test_create_trust(self):
        expires_at = timeutils.strtime(timeutils.utcnow() +
                                       datetime.timedelta(minutes=10),
                                       fmt=TIME_FORMAT)
        new_trust = self.create_trust(self.sample_data, self.trustor['name'],
                                      expires_at=expires_at)
        self.assertEqual(self.trustor['id'], new_trust['trustor_user_id'])
        self.assertEqual(self.trustee['id'], new_trust['trustee_user_id'])
        role_ids = [self.role_browser['id'], self.role_member['id']]
        self.assertTrue(timeutils.parse_strtime(new_trust['expires_at'],
                                                fmt=TIME_FORMAT))
        self.assertIn('%s/v3/OS-TRUST/' % HOST_URL,
                      new_trust['links']['self'])
        self.assertIn('%s/v3/OS-TRUST/' % HOST_URL,
                      new_trust['roles_links']['self'])

        for role in new_trust['roles']:
            self.assertIn(role['id'], role_ids)
Exemplo n.º 10
0
    def test_create_trust(self):
        expires_at = timeutils.strtime(timeutils.utcnow() +
                                       datetime.timedelta(minutes=10),
                                       fmt=TIME_FORMAT)
        new_trust = self.create_trust(self.sample_data,
                                      self.trustor['name'],
                                      expires_at=expires_at)
        self.assertEqual(self.trustor['id'], new_trust['trustor_user_id'])
        self.assertEqual(self.trustee['id'], new_trust['trustee_user_id'])
        role_ids = [self.role_browser['id'], self.role_member['id']]
        self.assertTrue(
            timeutils.parse_strtime(new_trust['expires_at'], fmt=TIME_FORMAT))
        self.assertIn('%s/v3/OS-TRUST/' % HOST_URL, new_trust['links']['self'])
        self.assertIn('%s/v3/OS-TRUST/' % HOST_URL,
                      new_trust['roles_links']['self'])

        for role in new_trust['roles']:
            self.assertIn(role['id'], role_ids)