|
6 | 6 | class AlertTestCase(unittest.TestCase): |
7 | 7 |
|
8 | 8 | def setUp(self): |
9 | | - self.client = Client(endpoint='http://api:8080/api', key='demo-key') |
| 9 | + self.client = Client(endpoint='http://api:8080', key='demo-key') |
10 | 10 |
|
11 | 11 | def test_alert(self): |
12 | 12 | id, alert, message = self.client.send_alert( |
@@ -63,8 +63,20 @@ def test_note(self): |
63 | 63 | environment='Production', resource='web02', event='node_down', correlated=['node_up', 'node_down'], |
64 | 64 | service=['Web', 'App'], severity='critical', tags=['london', 'linux'], value=4 |
65 | 65 | ) |
66 | | - n = self.client.alert_note(id, text='this is a test note') |
67 | | - self.assertEqual(n.text, 'this is a test note') |
| 66 | + note = self.client.alert_note(id, text='this is a test note') |
| 67 | + self.assertEqual(note.text, 'this is a test note') |
| 68 | + |
| 69 | + notes = self.client.get_alert_notes(id) |
| 70 | + self.assertEqual(notes[0].text, 'this is a test note') |
| 71 | + self.assertEqual(notes[0].user, 'admin@alerta.io') |
| 72 | + |
| 73 | + note = self.client.update_alert_note(id, notes[0].id, text='updated note text') |
| 74 | + self.assertEqual(note.text, 'updated note text') |
| 75 | + |
| 76 | + self.client.delete_alert_note(id, notes[0].id) |
| 77 | + |
| 78 | + notes = self.client.get_alert_notes(id) |
| 79 | + self.assertEqual(notes, []) |
68 | 80 |
|
69 | 81 | def test_permission(self): |
70 | 82 | perm = self.client.create_perm(role='websys', scopes=['admin:users', 'admin:keys', 'write']) |
|
0 commit comments