-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
43 lines (31 loc) · 1.02 KB
/
tests.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
# -*- coding: utf-8 -*-
import unittest
import os
from cloudstack import CloudStack
from cloudstack.utils import listvms
from requests.packages import urllib3
urllib3.disable_warnings()
cs = CloudStack(
api_url=os.environ['API_URL'],
secret=os.environ['API_SECRET'],
apiKey=os.environ['API_KEY']
)
class CloudStackAPIMethods(unittest.TestCase):
def test_listZones(self):
resp = cs.listZones({})
self.assertEqual(200, resp.status_code)
def test_listVolumes(self):
resp = cs.listVolumes({})
self.assertEqual(200, resp.status_code)
def test_listVirtualMachines(self):
resp = cs.listVirtualMachines({})
self.assertEqual(200, resp.status_code)
def test_listNetworks(self):
resp = cs.listNetworks({})
self.assertEqual(200, resp.status_code)
class CloudStackUtilsMethods(unittest.TestCase):
def test_listvms(self):
resp = listvms(cs)
self.assertEqual(True, isinstance(resp, list))
if __name__ == '__main__':
unittest.main()