diff --git a/compute/api/create_instance_test.py b/compute/api/create_instance_test.py index 226fef355a4..1374d821b9d 100644 --- a/compute/api/create_instance_test.py +++ b/compute/api/create_instance_test.py @@ -11,6 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import re + from nose.plugins.attrib import attr import tests @@ -21,10 +23,20 @@ class TestComputeGettingStarted(tests.CloudBaseTest): def test_main(self): - with tests.capture_stdout(): + with tests.capture_stdout() as mock_stdout: main( self.project_id, self.bucket_name, 'us-central1-f', 'test-instance', wait=False) + + stdout = mock_stdout.getvalue() + + expected_output = re.compile( + (r'Instances in project %s and zone us-central1-.* - test-instance' + r'.*Deleting instance.*done..$') % self.project_id, + re.DOTALL) + self.assertRegexpMatches( + stdout, + expected_output)