-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
49 lines (35 loc) · 940 Bytes
/
test.py
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
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
from ncc.config import PORT
from ncc.commands import *
from ncc.processes import supervisor
from unittest import TestCase
import urllib
import time
class FunctionalTestCase(TestCase):
@classmethod
def setUpClass(cls):
cmd_clean()
cmd_boot()
@classmethod
def tearDownClass(cls):
cmd_halt()
cmd_clean()
def test(self):
instances = cmd_list()
instance_num = len(instances)
instance = cmd_create()
iid = instance.iid
instances = cmd_list()
self.assertEqual(instance_num+1, len(instances))
time.sleep(10)
urllib.urlopen("http://localhost:%d/nuxeo/" % instance.port).read()
urllib.urlopen("http://%s:%d/nuxeo/" % (instance.hostname, PORT)).read()
cmd_stop(iid)
cmd_destroy(iid)
cmd_purge(iid)
class SupervisorTestCase(TestCase):
def test(self):
supervisor.gen_conf()
supervisor.start()
time.sleep(5)
supervisor.stop()