예제 #1
0
    def setUp(self):
        self.template = factories.TemplateFactory()
        self.flavor = factories.FlavorFactory()
        self.project = structure_factories.ProjectFactory()
        self.ssh_public_key = factories.SshPublicKeyFactory()
        self.membership = factories.CloudProjectMembershipFactory(
            cloud=self.flavor.cloud,
            project=self.project,
        )

        factories.ImageFactory(template=self.template, cloud=self.flavor.cloud)
        factories.FloatingIPFactory(status='DOWN',
                                    cloud_project_membership=self.membership,
                                    address='10.10.10.10')
예제 #2
0
def _instance_data(user, instance=None):
    if instance is None:
        instance = factories.InstanceFactory()
    flavor = factories.FlavorFactory(
        cloud=instance.cloud_project_membership.cloud)
    ssh_public_key = factories.SshPublicKeyFactory(user=user)
    return {
        'name': 'test_host',
        'description': 'test description',
        'project': _project_url(instance.cloud_project_membership.project),
        'template': _template_url(instance.template),
        'flavor': _flavor_url(flavor),
        'ssh_public_key': _ssh_public_key_url(ssh_public_key)
    }
예제 #3
0
 def test_user_cannot_delete_other_users_key(self):
     other_key = factories.SshPublicKeyFactory()
     self.client.force_authenticate(self.user)
     response = self.client.delete(
         factories.SshPublicKeyFactory.get_url(other_key))
     self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
예제 #4
0
 def setUp(self):
     self.staff = structure_factories.UserFactory(is_staff=True)
     self.user = structure_factories.UserFactory()
     self.user_key = factories.SshPublicKeyFactory(user=self.user)