Ejemplo n.º 1
0
    async def test_create_from_yaml(self):
        api_client = CoroutineMock()
        api_client.call_api = CoroutineMock()

        await create_from_yaml(api_client, 'examples/nginx-deployment.yaml')

        # simple check for api call
        self.assertEqual(api_client.call_api.call_args[0][0],
                         '/apis/apps/v1/namespaces/{namespace}/deployments')
Ejemplo n.º 2
0
    async def test_create_from_dict(self):
        api_client = CoroutineMock()
        api_client.call_api = CoroutineMock()
        api_client.call_api.return_value = 'mock-value'

        created = await create_from_dict(
            api_client, {
                'apiVersion': 'apps/v1',
                'kind': 'Deployment',
                'metadata': {
                    'name': 'nginx-deployment'
                },
                'spec': {
                    'replicas': 3,
                }
            })

        # simple check for api call
        self.assertEqual(api_client.call_api.call_args[0][0],
                         '/apis/apps/v1/namespaces/{namespace}/deployments')

        # returned values
        self.assertEqual(created, ['mock-value'])