-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipmi_tests.py
49 lines (36 loc) · 1.35 KB
/
ipmi_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
44
45
46
47
48
49
import sys
sys.path.append("/home/user/_cluster/cntrl_hac")
from exceptionz import DeviceError
from ipmi import IPMI
import unittest
# Working IPMI device.
IPMI_IP = "192.168.50.220"
IPMI_LOGIN = "ADMIN"
IPMI_PASSWORD = "ADMIN"
class TestsForIPMI(unittest.TestCase):
def test_correct_settings(self):
ipmi = IPMI("my_ipmi", {"ip": IPMI_IP,
"login": IPMI_LOGIN,
"password": IPMI_PASSWORD})
ipmi.off()
ipmi.on()
def test_wrong_ip(self):
ipmi = IPMI("my_ipmi", {"ip": "127.0.0.1",
"login": IPMI_LOGIN,
"password": IPMI_PASSWORD})
with self.assertRaises(DeviceError):
ipmi.off()
def test_wrong_login(self):
ipmi = IPMI("my_ipmi", {"ip": IPMI_IP,
"login": "OLOLOLOLOLOLOLOLOLOLOLOLOLO",
"password": IPMI_PASSWORD})
with self.assertRaises(DeviceError):
ipmi.off()
def test_wrong_password(self):
ipmi = IPMI("my_ipmi", {"ip": IPMI_IP,
"login": IPMI_LOGIN,
"password": "OLOLOLOLOLOLOLOLOLOLOLOLOLO"})
with self.assertRaises(DeviceError):
ipmi.off()
if (__name__ == '__main__'):
unittest.main()