Beispiel #1
0
 def test_server_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     federated = base.FederatedUserClient(grant.user.entity, grant.project.entity)
     server1 = self.useFixture(fixtures.Server(federated))
     server2 = self.useFixture(fixtures.Server(federated))
     openstack = base.OpenStackClient()
     server3 = self.useFixture(fixtures.Server(openstack))
     # Test filtering
     sentinel = base.SentinelClient()
     servers = sentinel.compute.servers.list(search_opts={'all_tenants': 'True'})
     self.assertEqual(len(servers), 2)
     self.assertThat(server1.entity, matchers.IsInCollection(servers))
     self.assertThat(server2.entity, matchers.IsInCollection(servers))
     self.assertThat(server3.entity, matchers.IsNotInCollection(servers))
     # Test limits
     servers = sentinel.compute.servers.list(
         search_opts={'all_tenants': 'True'},
         limit=1)
     self.assertEqual(len(servers), 1)
     servers = sentinel.compute.servers.list(
         search_opts={'all_tenants': 'True'},
         marker=servers[0].id,
         limit=1)
     self.assertEqual(len(servers), 1)
     servers = sentinel.compute.servers.list(
         search_opts={'all_tenants': 'True'},
         marker=servers[0].id,
         limit=1)
     self.assertEqual(len(servers), 0)
Beispiel #2
0
 def test_volume_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     federated = base.FederatedUserClient(grant.user.entity,
                                          grant.project.entity)
     volume1 = self.useFixture(fixtures.Volume(federated))
     volume2 = self.useFixture(fixtures.Volume(federated))
     openstack = base.OpenStackClient()
     volume3 = self.useFixture(fixtures.Volume(openstack))
     # Test filtering
     sentinel = base.SentinelClient()
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'})
     self.assertEqual(len(volumes), 2)
     self.assertThat(volume1.entity, matchers.IsInCollection(volumes))
     self.assertThat(volume2.entity, matchers.IsInCollection(volumes))
     self.assertThat(volume3.entity, matchers.IsNotInCollection(volumes))
     # Test limits
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'}, limit=1)
     self.assertEqual(len(volumes), 1)
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'}, marker=volumes[0].id, limit=1)
     self.assertEqual(len(volumes), 1)
     volumes = sentinel.volume.volumes.list(
         search_opts={'all_tenants': 'True'}, marker=volumes[0].id, limit=1)
     self.assertEqual(len(volumes), 0)
Beispiel #3
0
 def test_floatingip_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     federated = base.FederatedUserClient(grant.user.entity,
                                          grant.project.entity)
     floatingip1 = self.useFixture(fixtures.FloatingIP(federated))
     openstack = base.OpenStackClient()
     floatingip2 = self.useFixture(fixtures.FloatingIP(openstack))
     # Test filtering
     sentinel = base.SentinelClient()
     floatingips = list(sentinel.network.list_floatingips())
     self.assertEqual(len(floatingips), 1)
     self.assertThat(floatingip1.entity,
                     matchers.IsInCollection(floatingips))
     self.assertThat(floatingip2.entity,
                     matchers.IsNotInCollection(floatingips))
Beispiel #4
0
 def test_list(self):
     group = self.useFixture(fixtures.Group(self.sentinel))
     groups = self.sentinel.identity.groups.list()
     self.assertThat(group.entity, matchers.IsInCollection(groups))
Beispiel #5
0
 def test_group_list_users(self):
     user = self.useFixture(fixtures.User(self.sentinel))
     group = self.useFixture(fixtures.Group(self.sentinel))
     self.sentinel.identity.users.add_to_group(user.entity, group.entity)
     users = self.sentinel.identity.users.list(group=group.entity)
     self.assertThat(user.entity, matchers.IsInCollection(users))
Beispiel #6
0
 def test_list(self):
     project = self.useFixture(fixtures.Project(self.sentinel))
     projects = self.sentinel.identity.projects.list()
     self.assertThat(project.entity, matchers.IsInCollection(projects))
Beispiel #7
0
 def test_project_list(self):
     grant = self.useFixture(fixtures.UserProjectGrant(self.sentinel))
     projects = self.sentinel.identity.projects.list(user=grant.user.entity)
     self.assertThat(grant.project.entity,
                     matchers.IsInCollection(projects))
Beispiel #8
0
 def test_group_list(self):
     group_user = self.useFixture(fixtures.GroupUser(self.sentinel))
     groups = self.sentinel.identity.groups.list(
         user=group_user.user.entity)
     self.assertThat(group_user.group.entity,
                     matchers.IsInCollection(groups))
Beispiel #9
0
 def test_list(self):
     user = self.useFixture(fixtures.User(self.sentinel))
     users = self.sentinel.identity.users.list()
     self.assertThat(user.entity, matchers.IsInCollection(users))