summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests
diff options
context:
space:
mode:
authorRussell Haering <russellhaering@gmail.com>2014-06-07 09:02:18 -0700
committerRussell Haering <russellhaering@gmail.com>2014-06-08 18:01:10 -0700
commit263f97c0e0fe4792c5aca1ac107bc2d5bb38115d (patch)
tree709d47d0b73419a073f0992ef2db34903609e842 /ironic_python_agent/tests
parentdff46583d354ced83a056d404abc70fd3ac92de3 (diff)
downloadironic-python-agent-263f97c0e0fe4792c5aca1ac107bc2d5bb38115d.tar.gz
Expose decom.erase_hardware command via API
Expose an async decom.erase_hardware command in the API. Executing this command simply calls erase_devices on the loaded HardwareManager implementation. Change-Id: I238264a4d5903200ad6a30d82b61804c1e3f5916
Diffstat (limited to 'ironic_python_agent/tests')
-rw-r--r--ironic_python_agent/tests/extensions/decom.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/extensions/decom.py b/ironic_python_agent/tests/extensions/decom.py
index 10dc3d84..6a571d28 100644
--- a/ironic_python_agent/tests/extensions/decom.py
+++ b/ironic_python_agent/tests/extensions/decom.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import mock
from oslotest import base as test_base
from ironic_python_agent.extensions import decom
@@ -21,3 +22,10 @@ class TestDecomExtension(test_base.BaseTestCase):
def setUp(self):
super(TestDecomExtension, self).setUp()
self.agent_extension = decom.DecomExtension()
+
+ @mock.patch('ironic_python_agent.hardware.get_manager', autospec=True)
+ def test_erase_hardware(self, mocked_get_manager):
+ hardware_manager = mocked_get_manager.return_value
+ result = self.agent_extension.erase_hardware('erase_hardware')
+ result.join()
+ hardware_manager.erase_devices.assert_called_once_with()