-
Notifications
You must be signed in to change notification settings - Fork 30
/
test_write_attributes.py
38 lines (29 loc) · 1.61 KB
/
test_write_attributes.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
""" This script contains the unit tests for the WriteAttributes Script """
import unittest
from appsettings import PIWEBAPI_URL, AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL
class TestStringMethods(unittest.TestCase):
"""
We recommend running these unit tests using the file syntax:
python -m unittest test_write_attributes
To discover and run all unit tests: python -m unittest
To run the unit tests in a file: python -m unittest test_write_attributes
To run a single test:
python -m unittest test_write_attributes.TestStringMethods.test_writedataset
"""
def test_writesinglevalue(self):
""" Test the write_single_value method """
from write_attributes import write_single_value
self.assertEqual(write_single_value(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 202)
def test_writedataset(self):
""" Test the write_data_set method """
from write_attributes import write_data_set
self.assertEqual(write_data_set(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 202)
def test_updateattributevalue(self):
""" Test the update_attribute_value method """
from write_attributes import update_attribute_value
self.assertEqual(update_attribute_value(PIWEBAPI_URL,
AF_SERVER_NAME, USER_NAME, USER_PASSWORD, AUTH_TYPE, VERIFY_SSL), 204)
if __name__ == '__main__':
unittest.main()