Skip to content

Commit

Permalink
Merge pull request #133 from GoogleCloudPlatform/compute-test
Browse files Browse the repository at this point in the history
Make create_instance_test fail on bad output.
  • Loading branch information
jerjou committed Oct 23, 2015
2 parents 19ce263 + 0f42220 commit 1ff6a5b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion compute/api/create_instance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

0 comments on commit 1ff6a5b

Please sign in to comment.