]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Refactor unit tests for NEC Plugin
authorRyota MIBU <r-mibu@cq.jp.nec.com>
Fri, 5 Jul 2013 07:03:59 +0000 (16:03 +0900)
committerRyota MIBU <r-mibu@cq.jp.nec.com>
Fri, 12 Jul 2013 06:40:33 +0000 (15:40 +0900)
commitbf11f609d04535f2acfe6690dbc6e3c4594f936c
tree6b36bf95055bed4923714bb7aac230665293452b
parentdebf76943e2a4c8313bc9b9f38c59578820b831f
Refactor unit tests for NEC Plugin

blueprint nec-plugin-test-coverage

This commit refactors the base class of unit tests for NEC Plugin to
make writing new tests easier.

Add fake OFC Manager and change unit tests which use OFC Manager mock
to using this fake.  With this fake, we don't need to set return_value
and side_effect to the mock instance of OFC Manager in each test case.
This fake keeps all resources on OFC, and returns existence of
resources properly.  This fake is attached to OFC Manager mock instance
by setting all side_effects.  We can also set it to raise an exception.

Make NEC Plugin configurable in each test case.  Now we can configure
NEC Plugin by setting string in class value "_nec_ini" which will be
written into a temporal file and loaded by NEC plugin.

Move setup for callbacks into NecPluginV2TestCase() so that other unit
tests can use callbacks.

Change-Id: I3a52423bb5813547345677dc49abfea6563dd6cd
neutron/plugins/nec/nec_plugin.py
neutron/tests/unit/nec/fake_ofc_manager.py [new file with mode: 0644]
neutron/tests/unit/nec/test_nec_plugin.py
neutron/tests/unit/nec/test_security_group.py