def test_create_cluster_template_invalid_volume_driver(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() gen_model.volume_driver = 'invalid_volume_driver' self.assertRaises(exceptions.BadRequest, self.cluster_template_client.post_cluster_template, gen_model)
def test_create_cluster_template_invalid_volume_driver(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() gen_model.volume_driver = 'invalid_volume_driver' self.assertRaises( exceptions.BadRequest, self.cluster_template_client.post_cluster_template, gen_model)
def test_delete_cluster_template_by_name(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, model = self._create_cluster_template(gen_model) resp, _ = self.cluster_template_client.delete_cluster_template( model.name) self.assertEqual(204, resp.status) self.cluster_templates.remove(model.uuid)
def test_list_cluster_templates(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() _, temp_model = self._create_cluster_template(gen_model) resp, model = self.cluster_template_client.list_cluster_templates() self.assertEqual(200, resp.status) self.assertGreater(len(model.clustertemplates), 0) self.assertIn(temp_model.uuid, list([x['uuid'] for x in model.clustertemplates]))
def test_update_cluster_template_invalid_patch(self): # get json object gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, old_model = self._create_cluster_template(gen_model) self.assertRaises(exceptions.BadRequest, self.cluster_template_client.patch_cluster_template, data_utils.rand_uuid(), gen_model)
def test_list_cluster_templates(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() _, temp_model = self._create_cluster_template(gen_model) resp, model = self.cluster_template_client.list_cluster_templates() self.assertEqual(200, resp.status) self.assertGreater(len(model.clustertemplates), 0) self.assertIn( temp_model.uuid, list([x['uuid'] for x in model.clustertemplates]))
def test_update_cluster_template_invalid_patch(self): # get json object gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, old_model = self._create_cluster_template(gen_model) self.assertRaises( exceptions.BadRequest, self.cluster_template_client.patch_cluster_template, data_utils.rand_uuid(), gen_model)
def test_update_cluster_template_public_by_uuid(self): path = "/public" gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, old_model = self._create_cluster_template(gen_model) patch_model = datagen.cluster_template_replace_patch_data(path, value=True) self.assertRaises(exceptions.Forbidden, self.cluster_template_client.patch_cluster_template, old_model.uuid, patch_model)
def test_update_cluster_template_by_uuid(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, old_model = self._create_cluster_template(gen_model) patch_model = datagen.cluster_template_name_patch_data() resp, new_model = self.cluster_template_client.patch_cluster_template( old_model.uuid, patch_model) self.assertEqual(200, resp.status) resp, model = \ self.cluster_template_client.get_cluster_template(new_model.uuid) self.assertEqual(200, resp.status) self.assertEqual(old_model.uuid, new_model.uuid) self.assertEqual(model.name, new_model.name)
def test_create_cluster_with_nonexisting_flavor(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, cluster_template = self._create_cluster_template(gen_model) self.assertEqual(201, resp.status) self.assertIsNotNone(cluster_template.uuid) uuid = cluster_template.uuid gen_model = datagen.valid_cluster_data(cluster_template_id=uuid) gen_model.flavor_id = 'aaa' self.assertRaises(exceptions.BadRequest, self.cluster_client.post_cluster, gen_model) resp, _ = self._delete_cluster_template(cluster_template.uuid) self.assertEqual(204, resp.status)
def test_update_cluster_template_public_by_uuid(self): path = "/public" gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, old_model = self._create_cluster_template(gen_model) patch_model = datagen.cluster_template_replace_patch_data(path, value=True) resp, new_model = self.cluster_template_client.patch_cluster_template( old_model.uuid, patch_model) self.assertEqual(200, resp.status) resp, model = self.cluster_template_client.get_cluster_template( new_model.uuid) self.assertEqual(200, resp.status) self.assertTrue(model.public)
def test_create_cluster_template(self): gen_model = \ datagen.cluster_template_data_with_valid_keypair_image_flavor() resp, model = self._create_cluster_template(gen_model)