summaryrefslogtreecommitdiffstats
path: root/qa/tasks/mgr/dashboard/test_summary.py
blob: 1a5d1e9918f949c51a5173e2b9d5d1a4be8f86ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from __future__ import absolute_import

from .helper import DashboardTestCase


class SummaryTest(DashboardTestCase):
    CEPHFS = True

    def test_summary(self):
        data = self._get("/api/summary")
        self.assertStatus(200)

        self.assertIn('health_status', data)
        self.assertIn('mgr_id', data)
        self.assertIn('have_mon_connection', data)
        self.assertIn('rbd_mirroring', data)
        self.assertIn('executing_tasks', data)
        self.assertIn('finished_tasks', data)
        self.assertIn('version', data)
        self.assertIsNotNone(data['health_status'])
        self.assertIsNotNone(data['mgr_id'])
        self.assertIsNotNone(data['have_mon_connection'])
        self.assertEqual(data['rbd_mirroring'], {'errors': 0, 'warnings': 0})

    @DashboardTestCase.RunAs('test', 'test', ['pool-manager'])
    def test_summary_permissions(self):
        data = self._get("/api/summary")
        self.assertStatus(200)

        self.assertIn('health_status', data)
        self.assertIn('mgr_id', data)
        self.assertIn('have_mon_connection', data)
        self.assertNotIn('rbd_mirroring', data)
        self.assertIn('executing_tasks', data)
        self.assertIn('finished_tasks', data)
        self.assertIn('version', data)
        self.assertIsNotNone(data['health_status'])
        self.assertIsNotNone(data['mgr_id'])
        self.assertIsNotNone(data['have_mon_connection'])