Skip to content

Commit c2452f8

Browse files
authored
test: add unit test for create_from_yaml (#79)
1 parent 3e56bdf commit c2452f8

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

kubernetes_asyncio/test/test_utils_create_from_yaml.py

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2019 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from asynctest import CoroutineMock, TestCase
16+
17+
from kubernetes_asyncio.utils import create_from_yaml
18+
19+
20+
class CreateFromYamlTest(TestCase):
21+
22+
async def test_create_from_yaml(self):
23+
api_client = CoroutineMock()
24+
api_client.call_api = CoroutineMock()
25+
26+
await create_from_yaml(api_client, 'examples/nginx-deployment.yaml')
27+
28+
# simple check for api call
29+
self.assertEqual(api_client.call_api.call_args[0][0],
30+
'/apis/extensions/v1beta1/namespaces/{namespace}/deployments')
31+
32+
33+
if __name__ == '__main__':
34+
import asynctest
35+
asynctest.main()

0 commit comments

Comments
 (0)