Stub out unmocked keystone auth in signal tests

While these tests do setup a mock for keystoneclient, one of the tests
clears out these stubs before exitting to avoid needing to stub out
things stack_delete_after will do. However, stack_delete_after will
trigger a call to keystoneclient which leads to unmocked calls trying to
reach server.test from inside the tests. These failures go undetected
because they are after the test, and nothing is checking for error
events in this phase.

Change-Id: I608e0b5a263587d5151b4cb4ce3f03e289c4bdca
Partial-Bug: #1227962
This commit is contained in:
Clint Byrum 2013-10-24 00:59:17 -07:00
parent 7f0c49e742
commit 5d1942f85a
1 changed files with 9 additions and 1 deletions

View File

@ -211,9 +211,17 @@ class SignalTest(HeatTestCase):
rsrc.signal(details=test_d)
self.m.VerifyAll()
# so we don't have to stub out deletion events.
self.m.UnsetStubs()
# Since we unset the stubs above we must re-stub keystone to keep the
# test isolated from keystoneclient. The unset stubs is done so that we
# do not have to mock out all of the deleting that the
# stack_delete_after decorator will do during cleanup.
self.m.StubOutWithMock(self.stack.clients, 'keystone')
self.stack.clients.keystone().AndReturn(self.fc)
self.m.ReplayAll()
@utils.stack_delete_after
def test_signal_wrong_resource(self):
# assert that we get the correct exception when calling a