summaryrefslogtreecommitdiff
path: root/watcher_tempest_plugin/tests/api/admin/test_service.py
diff options
context:
space:
mode:
Diffstat (limited to 'watcher_tempest_plugin/tests/api/admin/test_service.py')
-rw-r--r--watcher_tempest_plugin/tests/api/admin/test_service.py90
1 files changed, 0 insertions, 90 deletions
diff --git a/watcher_tempest_plugin/tests/api/admin/test_service.py b/watcher_tempest_plugin/tests/api/admin/test_service.py
deleted file mode 100644
index 948d8b1..0000000
--- a/watcher_tempest_plugin/tests/api/admin/test_service.py
+++ /dev/null
@@ -1,90 +0,0 @@
1# -*- encoding: utf-8 -*-
2# Copyright (c) 2016 Servionica
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17from __future__ import unicode_literals
18
19from tempest.lib import decorators
20
21from watcher_tempest_plugin.tests.api.admin import base
22
23
24class TestShowListService(base.BaseInfraOptimTest):
25 """Tests for services"""
26
27 DECISION_ENGINE = "watcher-decision-engine"
28 APPLIER = "watcher-applier"
29
30 @classmethod
31 def resource_setup(cls):
32 super(TestShowListService, cls).resource_setup()
33
34 def assert_expected(self, expected, actual,
35 keys=('created_at', 'updated_at', 'deleted_at')):
36 super(TestShowListService, self).assert_expected(
37 expected, actual, keys)
38
39 @decorators.attr(type='smoke')
40 def test_show_service(self):
41 _, body = self.client.list_services()
42 self.assertIn('services', body)
43 services = body['services']
44 self.assertIn(self.DECISION_ENGINE,
45 [i['name'] for i in body['services']])
46
47 service_id = filter(lambda x: self.DECISION_ENGINE == x['name'],
48 services)[0]['id']
49 _, service = self.client.show_service(service_id)
50
51 self.assertEqual(self.DECISION_ENGINE, service['name'])
52 self.assertIn("host", service.keys())
53 self.assertIn("last_seen_up", service.keys())
54 self.assertIn("status", service.keys())
55
56 @decorators.attr(type='smoke')
57 def test_show_service_with_links(self):
58 _, body = self.client.list_services()
59 self.assertIn('services', body)
60 services = body['services']
61 self.assertIn(self.DECISION_ENGINE,
62 [i['name'] for i in body['services']])
63
64 service_id = filter(lambda x: self.DECISION_ENGINE == x['name'],
65 services)[0]['id']
66 _, service = self.client.show_service(service_id)
67
68 self.assertIn('links', service.keys())
69 self.assertEqual(2, len(service['links']))
70 self.assertIn(str(service['id']),
71 service['links'][0]['href'])
72
73 @decorators.attr(type="smoke")
74 def test_list_services(self):
75 _, body = self.client.list_services()
76 self.assertIn('services', body)
77 services = body['services']
78 self.assertIn(self.DECISION_ENGINE,
79 [i['name'] for i in body['services']])
80
81 for service in services:
82 self.assertTrue(
83 all(val is not None for key, val in service.items()
84 if key in ['id', 'name', 'host', 'status',
85 'last_seen_up']))
86
87 # Verify self links.
88 for service in body['services']:
89 self.validate_self_link('services', service['id'],
90 service['links'][0]['href'])