ceph/qa/tasks/mgr/dashboard/test_logs.py
Kefu Chai b0bdbc3414 qa/tasks/mgr: partial revert of 'import with full path'
this change partially reverts #34139

using relative import helps with readability and ease the pain to write
down the full parent module name

in #34139, all relative imports were replaced with full path, because we
were using following code to verify if the code is python3 compatible:

```
  mod_spec = importlib.util.spec_from_file_location(mod_name, path)
  mod = importlib.util.module_from_spec(mod_spec)
  mod_spec.loader.exec_module(mod)
```

but this does not work with submodule which can import using relative
import without specifying the name of the package and its parent module.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-03-26 14:37:06 +08:00

39 lines
1023 B
Python

# -*- 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)