Exemplo n.º 1
0
    def test_cluster_delete(self, client):
        test_cluster = TEST.clusters.first()
        request = self.mock_rest_request(body='{"cluster_id":' +
                                         str(test_cluster['uuid']) + '}')
        response = magnum.Clusters().delete(request)

        self.assertStatusCode(response, 204)
        client.cluster_delete.assert_called_once_with(request, u'cluster_id')
Exemplo n.º 2
0
    def test_cluster_get(self, client):
        request = self.mock_rest_request()
        client.cluster_list.return_value = \
            mock_resource(TEST.clusters.list())
        response = magnum.Clusters().get(request)

        self.assertStatusCode(response, 200)
        self.assertItemsCollectionEqual(response, TEST.clusters.list())
        client.cluster_list.assert_called_once_with(request)
Exemplo n.º 3
0
    def test_cluster_create(self, client):
        test_clusters = mock_resource(TEST.clusters.list())
        test_cluster = test_clusters[0]
        test_body = json.dumps(test_cluster.to_dict())
        request = self.mock_rest_request(body=test_body)
        client.cluster_create.return_value = test_cluster
        response = magnum.Clusters().post(request)
        url = '/api/container_infra/cluster/%s' % test_cluster.uuid

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