Shift EnvironmentVariable fixture setup to base

While investigating a different branch, I came across a test failure
due to the ROOT_DISK environment variable leaking into a test. The
CMDEnvironmentTest already had code to deal with that case, added to
deal with the same problem affecting it, so I moved the code into
the base module so all tests can benefit.

Change-Id: I7e82584f75a309c4cea6fb3f7c0c420358c778e1
This commit is contained in:
Steve Kowalik 2015-02-11 16:30:51 +11:00
parent 3bf3346e7c
commit 2a80f77c54
2 changed files with 5 additions and 8 deletions

View File

@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import fixtures
import mock
import testtools
@ -24,13 +23,6 @@ from os_cloud_config.tests import base
class CMDEnviromentTest(base.TestCase):
def setUp(self):
super(CMDEnviromentTest, self).setUp()
for key in ('OS_AUTH_URL', 'OS_PASSWORD', 'OS_TENANT_NAME',
'OS_USERNAME', 'OS_CACERT'):
fixture = fixtures.EnvironmentVariable(key)
self.useFixture(fixture)
@mock.patch.dict('os.environ', {})
def test_ensure_environment_missing_all(self):
message = ("OS_AUTH_URL, OS_PASSWORD, OS_TENANT_NAME, OS_USERNAME "

View File

@ -51,3 +51,8 @@ class TestCase(testtools.TestCase):
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
self.log_fixture = self.useFixture(fixtures.FakeLogger())
for key in ('OS_AUTH_URL', 'OS_PASSWORD', 'OS_TENANT_NAME',
'OS_USERNAME', 'OS_CACERT', 'ROOT_DISK'):
fixture = fixtures.EnvironmentVariable(key)
self.useFixture(fixture)