Test: Add unit test for PSU plug out and in
Split the function into two, one for handling the sdbus::message, the
other for handling the changed properties, so that it's easier to write
unit test cases.
Added the test cases:
* On a system with a PSU present, remove the PSU;
* On a system without PSU, plug the PSU in;
* On a system with a PSU, remove the PSU and add it back, while the
propertiesChanged callback is invoked with both Present and Version
properties.
* On a system with two PSUs with same version, remove them one-by-one,
and add back one-by-one, while PSU1 has a different version.
Tested: Verify ItemUpdater correctly handles the above cases:
* Remove the activation and version object if PSU is removed;
* Create activation and version object if PSU is added;
* When there are two PSUs with same version, removing one only
update the associations, removing the other shall result in
the objects to be removed;
Adding one back will create the objects, and adding the other
one with different version will create new objects.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I14c7ae9f03ec91bb1c85bb5a18d69f20dc1efd53
3 files changed