From 75fa390d6b13d0195fa18b5fa03375ae245c78ba Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Thu, 18 Feb 2016 14:34:21 -0800 Subject: [PATCH] Moving monitoring samples to py.test --- monitoring/api/auth_test.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/monitoring/api/auth_test.py b/monitoring/api/auth_test.py index 49725a5f2b1a..4d0d37a029ab 100644 --- a/monitoring/api/auth_test.py +++ b/monitoring/api/auth_test.py @@ -14,18 +14,15 @@ import re import auth -import testing -class TestTimeseriesList(testing.CloudTest): +def test_main(cloud_config, capsys): + auth.main(cloud_config.GCLOUD_PROJECT) + output, _ = capsys.readouterr() - def test_main(self): - with testing.capture_stdout() as stdout: - auth.main(self.config.GCLOUD_PROJECT) - - output = stdout.getvalue().strip() - - self.assertRegexpMatches( - output, re.compile(r'Timeseries.list raw response:\s*' - r'{\s*"kind": "[^"]+",' - r'\s*"oldest": *"[0-9]+', re.S)) + assert re.search( + re.compile( + r'Timeseries.list raw response:\s*' + r'{\s*"kind": "[^"]+",' + r'\s*"oldest": *"[0-9]+', re.S), + output)