-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_events.py
More file actions
38 lines (31 loc) · 1.07 KB
/
test_events.py
File metadata and controls
38 lines (31 loc) · 1.07 KB
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
"""
Unit tests for the Drycc scheduler module.
Run the tests with './manage.py test scheduler'
"""
from scheduler.tests import TestCase
class EventTest(TestCase):
"""Tests scheduler pod calls"""
def create_event(self, namespace, name, **kwargs):
"""
Helper function to create and verify a events on the namespace
"""
self.scheduler.ns.create(namespace)
message = "Scaled down replica set test-869947c55f to 1 from 2"
# these are all required even if it is kwargs...
kwargs = {
'reason': 'ScalingReplicaSet',
'type': 'Normal'
}
return self.scheduler.events.create(
namespace,
name,
message,
**kwargs
)
def test_create(self):
response = self.create_event("test-event", "test-event")
self.assertEqual(response.status_code, 201)
def test_get_events(self):
# test success
response = self.scheduler.events.get("test-event", "test-event")
self.assertEqual(response.status_code, 200)