summaryrefslogtreecommitdiffstats
path: root/qa/tasks/mgr/dashboard/test_logs.py
blob: 17d5d830c99666dd2a628b26d72b23c06820ad9b (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
# -*- coding: utf-8 -*-
from __future__ import absolute_import

from .helper import DashboardTestCase, JList, JObj


class LogsTest(DashboardTestCase):
    CEPHFS = True

    def test_logs(self):
        data = self._get("/api/logs/all")
        self.assertStatus(200)
        log_entry_schema = JList(JObj({
            'addrs': JObj({
                'addrvec': JList(JObj({
                    'addr': str,
                    'nonce': int,
                    'type': str
                }))
            }),
            'channel': str,
            'message': str,
            'name': str,
            'priority': str,
            'rank': str,
            'seq': int,
            'stamp': str
        }))
        schema = JObj({
            'audit_log': log_entry_schema,
            'clog': log_entry_schema
        })
        self.assertSchema(data, schema)

    @DashboardTestCase.RunAs('test', 'test', ['pool-manager'])
    def test_log_perms(self):
        self._get("/api/logs/all")
        self.assertStatus(403)