|
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' |
| 14 | + |
6 | 15 | def test_miniprobe_hash_access_key(): |
7 | 16 | """miniprobe returns the correct hash_access_key""" |
8 | 17 | test_hash_access_key = miniprobe.MiniProbe() |
9 | 18 | assert_equal(test_hash_access_key.hash_access_key('test'), 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3') |
10 | 19 |
|
| 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': '{}'}) |
| 25 | + |
| 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') |
0 commit comments