import testtools from unittest.mock import patch from probert.prober import Prober from probert.storage import Storage from probert.network import NetworkProber class ProbertTestProber(testtools.TestCase): def test_prober_init(self): p = Prober() self.assertNotEqual(p, None) @patch.object(Prober, 'probe_all') def test_prober_probe_all(self, _probe_all): p = Prober() p.probe_all() self.assertTrue(_probe_all.called) @patch.object(Prober, 'probe_network') @patch.object(Prober, 'probe_storage') def test_prober_probe_all_invoke_others(self, _storage, _network): p = Prober() p.probe_all() self.assertTrue(_storage.called) self.assertTrue(_network.called) def test_prober_get_results(self): p = Prober() self.assertEqual({}, p.get_results()) @patch.object(NetworkProber, 'probe') @patch.object(Storage, 'probe') def test_prober_probe_all_check_results(self, _storage, _network): p = Prober() results = { 'storage': {'lambic': 99}, 'network': {'saison': 99}, } _storage.return_value = results['storage'] _network.return_value = results['network'] p.probe_all() self.assertTrue(_storage.called) self.assertTrue(_network.called) self.assertEqual(results, p.get_results())
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
data | Folder | 0755 |
|
|
__init__.py | File | 0 B | 0644 |
|
fakes.py | File | 201 B | 0644 |
|
helpers.py | File | 1.48 KB | 0644 |
|
test_dasd.py | File | 9.49 KB | 0644 |
|
test_lvm.py | File | 12.18 KB | 0644 |
|
test_multipath.py | File | 4.53 KB | 0644 |
|
test_prober.py | File | 1.37 KB | 0644 |
|
test_storage.py | File | 1.89 KB | 0644 |
|
test_utils.py | File | 2.21 KB | 0644 |
|