This change introduces a new base test class that mocks out
utils.execute and forces an exception if it gets called.
This has rooted out many tests that were doing this as a side effect of
calling other functions, doing things like modprobe and running iscsi
on the host's actual machine.
The tests are all now appropriately patched in places where this was
happening, and the new base class permanently prevents this from
accidentally happening again.
If you really want to call utils.execute() then you need to re-mock it
in your unit test.
Change-Id: Idf87d09a9c01a6bfe2767f8becabe65c02983518
Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.
Change-Id: Iad3f8fbb23a8b0f9e5ae4f304799465724c1a433
Closes-bug: #1280522
Create a SerializableComparable class derived from the Serializable
class.
Added the following functions to the SerializableComparable class:
'__eq__'
'__ne__'
Disable the '__hash__' function in the SerializableComparable class as
some derived classes are mutable.
Use the SerializableComparable class in hardware.py and
extensions/base.py
This should make unit testing users of the class easier when doing a
self.assertEqual() or self.assertNotEqual()
Added some initial unit testing for encoding.py
Change-Id: If0f14b3bfe7f1391f65dd730a16a534afed0da82