-
Notifications
You must be signed in to change notification settings - Fork 34
/
test_create_sandbox.py
68 lines (54 loc) · 3.1 KB
/
test_create_sandbox.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
""" This script contains the unit tests for the CreateSandbox Script """
import unittest
from appsettings import PIWEBAPI_URL, AF_SERVER_NAME, PI_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL
class TestStringMethods(unittest.TestCase):
"""
Run each unit tests in order, manually using the following example:
python -m unittest test_create_sandbox.TestStringMethods.test_createdatabase
To discover and run all unit tests: python -m unittest
To run the unit tests in a file: python -m unittest test_create_sandbox
To run a single test:
python -m unittest test_create_sandbox.TestStringMethods.test_createdatabase
"""
def test_createdatabase(self):
""" Test the create_database method """
from create_sandbox import create_database
self.assertEqual(create_database(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 201)
def test_createcategory(self):
""" Test the create_category method """
from create_sandbox import create_category
self.assertEqual(create_category(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 201)
def test_createtemplate(self):
""" Test the create_template method """
from create_sandbox import create_template
self.assertEqual(create_template(PIWEBAPI_URL,
AF_SERVER_NAME, PI_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 201)
def test_createelement(self):
""" Test the create_element method """
from create_sandbox import create_element
self.assertEqual(create_element(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 200)
def test_deleteelement(self):
""" Test the delete_element method """
from create_sandbox import delete_element
self.assertEqual(delete_element(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 204)
def test_deletetemplate(self):
""" Test the delete_template method """
from create_sandbox import delete_template
self.assertEqual(delete_template(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 204)
def test_deletecategory(self):
""" Test the delete_category method """
from create_sandbox import delete_category
self.assertEqual(delete_category(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 204)
def test_deletedatabase(self):
""" Test the create_database method """
from create_sandbox import delete_database
self.assertEqual(delete_database(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 204)
if __name__ == '__main__':
unittest.main()