コード例 #1
0
    def test_cluster_template_delete(self, client):
        test_cluster_template = TEST.cluster_templates.first()
        request = self.mock_rest_request(body='{"cluster_template_id":' +
                                         str(test_cluster_template['uuid']) +
                                         '}')
        response = magnum.ClusterTemplates().delete(request)

        self.assertStatusCode(response, 204)
        client.cluster_template_delete.assert_called_once_with(
            request, u'cluster_template_id')
コード例 #2
0
    def test_cluster_template_get(self, client):
        request = self.mock_rest_request()
        client.cluster_template_list.return_value = \
            mock_resource(TEST.cluster_templates.list())
        response = magnum.ClusterTemplates().get(request)

        self.assertStatusCode(response, 200)
        self.assertItemsCollectionEqual(response,
                                        TEST.cluster_templates.list())
        client.cluster_template_list.assert_called_once_with(request)
コード例 #3
0
    def test_cluster_template_create(self, client):
        test_cluster_templates = mock_resource(TEST.cluster_templates.list())
        test_cluster_template = test_cluster_templates[0]
        test_body = json.dumps(test_cluster_template.to_dict())
        request = self.mock_rest_request(body=test_body)
        client.cluster_template_create.return_value = test_cluster_template
        response = magnum.ClusterTemplates().post(request)
        url = '/api/container_infra/cluster_template/%s' % \
              test_cluster_template.uuid

        self.assertStatusCode(response, 201)
        self.assertEqual(response['location'], url)
        client.cluster_template_create.assert_called_once_with(
            request, **test_cluster_template.to_dict())