|
3 | 3 | from nose.tools import * |
4 | 4 | from miniprobe import miniprobe |
5 | 5 |
|
6 | | -config = {} |
7 | | -config['gid'] = 'testgid' |
8 | | -config['key'] = 'testkey' |
9 | | -config['protocol'] = 'testprotocol' |
10 | | -config['name'] = 'testname' |
11 | | -config['baseinterval'] = 'testbaseinterval' |
12 | | -config['server'] = 'testserver' |
13 | | -config['port'] = 'testport' |
| 6 | +class TestMiniProbe(): |
| 7 | + @classmethod |
| 8 | + def setup_class(cls): |
| 9 | + cls.config = {} |
| 10 | + cls.mp = miniprobe.MiniProbe() |
| 11 | + cls.config['gid'] = 'testgid' |
| 12 | + cls.config['key'] = 'testkey' |
| 13 | + cls.config['protocol'] = 'testprotocol' |
| 14 | + cls.config['name'] = 'testname' |
| 15 | + cls.config['baseinterval'] = 'testbaseinterval' |
| 16 | + cls.config['server'] = 'testserver' |
| 17 | + cls.config['port'] = 'testport' |
14 | 18 |
|
15 | | -def test_miniprobe_hash_access_key(): |
16 | | - """miniprobe returns the correct hash_access_key""" |
17 | | - test_hash_access_key = miniprobe.MiniProbe() |
18 | | - assert_equal(test_hash_access_key.hash_access_key('test'), 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3') |
| 19 | + def test_miniprobe_hash_access_key(self): |
| 20 | + """miniprobe returns the correct hash_access_key""" |
| 21 | + test_hash_access_key = self.mp |
| 22 | + assert_equal(test_hash_access_key.hash_access_key(self.config['key']), '913a73b565c8e2c8ed94497580f619397709b8b6') |
19 | 23 |
|
20 | | -def test_miniprobe_create_parameters(): |
21 | | - """miniprobe returns the correct create_parameters""" |
22 | | - test_create_parameters = miniprobe.MiniProbe() |
23 | | - assert_equal(test_create_parameters.create_parameters(config, '{}'), {'gid': 'testgid', 'protocol': 'testprotocol', 'key': '913a73b565c8e2c8ed94497580f619397709b8b6'}) |
24 | | - assert_equal(test_create_parameters.create_parameters(config, '{}', 'announce'), {'protocol': 'testprotocol', 'name': 'testname', 'gid': 'testgid', 'baseinterval': 'testbaseinterval', 'key': '913a73b565c8e2c8ed94497580f619397709b8b6', 'sensors': '{}'}) |
| 24 | + def test_miniprobe_create_parameters(self): |
| 25 | + """miniprobe returns the correct create_parameters""" |
| 26 | + test_create_parameters = self.mp |
| 27 | + assert_equal(test_create_parameters.create_parameters(self.config, '{}'), {'gid': 'testgid', 'protocol': 'testprotocol', 'key': '913a73b565c8e2c8ed94497580f619397709b8b6'}) |
| 28 | + assert_equal(test_create_parameters.create_parameters(self.config, '{}', 'announce'), {'protocol': 'testprotocol', 'name': 'testname', 'gid': 'testgid', 'baseinterval': 'testbaseinterval', 'key': '913a73b565c8e2c8ed94497580f619397709b8b6', 'sensors': '{}'}) |
25 | 29 |
|
26 | | -def test_miniprobe_create_url(): |
27 | | - """miniprobe returns the correct create_url""" |
28 | | - test_create_url = miniprobe.MiniProbe() |
29 | | - assert_equal(test_create_url.create_url(config), 'No method given') |
30 | | - assert_equal(test_create_url.create_url(config, 'test'), 'https://testserver:testport/probe/test') |
31 | | - assert_equal(test_create_url.create_url(config, 'data'), 'https://testserver:testport/probe/data?gid=testgid&protocol=testprotocol&key=913a73b565c8e2c8ed94497580f619397709b8b6') |
| 30 | + def test_miniprobe_create_url(self): |
| 31 | + """miniprobe returns the correct create_url""" |
| 32 | + test_create_url = self.mp |
| 33 | + assert_equal(test_create_url.create_url(self.config), 'No method given') |
| 34 | + assert_equal(test_create_url.create_url(self.config, 'test'), 'https://testserver:testport/probe/test') |
| 35 | + assert_equal(test_create_url.create_url(self.config, 'data'), 'https://testserver:testport/probe/data?gid=testgid&protocol=testprotocol&key=913a73b565c8e2c8ed94497580f619397709b8b6') |
0 commit comments