]>
Commit | Line | Data |
---|---|---|
522d829b TL |
1 | # -*- coding: utf-8 -*- |
2 | # pylint: disable=too-many-public-methods | |
3 | ||
4 | from __future__ import absolute_import | |
5 | ||
6 | import time | |
7 | ||
8 | from .helper import DashboardTestCase | |
9 | ||
10 | ||
11 | class MotdTest(DashboardTestCase): | |
12 | @classmethod | |
13 | def tearDownClass(cls): | |
14 | cls._ceph_cmd(['dashboard', 'motd', 'clear']) | |
15 | super(MotdTest, cls).tearDownClass() | |
16 | ||
17 | def setUp(self): | |
18 | super(MotdTest, self).setUp() | |
19 | self._ceph_cmd(['dashboard', 'motd', 'clear']) | |
20 | ||
21 | def test_none(self): | |
22 | data = self._get('/ui-api/motd') | |
23 | self.assertStatus(200) | |
24 | self.assertIsNone(data) | |
25 | ||
26 | def test_set(self): | |
27 | self._ceph_cmd(['dashboard', 'motd', 'set', 'info', '0', 'foo bar baz']) | |
28 | data = self._get('/ui-api/motd') | |
29 | self.assertStatus(200) | |
30 | self.assertIsInstance(data, dict) | |
31 | ||
32 | def test_expired(self): | |
33 | self._ceph_cmd(['dashboard', 'motd', 'set', 'info', '2s', 'foo bar baz']) | |
34 | time.sleep(5) | |
35 | data = self._get('/ui-api/motd') | |
36 | self.assertStatus(200) | |
37 | self.assertIsNone(data) |