From 12835a2d73df6c9a84cdc2ff535891254e526871 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 9 Oct 2013 13:58:33 -0400 Subject: [PATCH] Fix test_files_at_url_pass Previously there would be an error from mox related to urlopen in test_files_at_url_pass causing the test to fail. This commit gets around it by stubbing out url open instead of using mox. Change-Id: I1405862151f97ebfaa2cf22fd993cbc5f07e7b0c --- elastic_recheck/tests/unit/test_required_files.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/elastic_recheck/tests/unit/test_required_files.py b/elastic_recheck/tests/unit/test_required_files.py index 819f4e29..62786c8c 100644 --- a/elastic_recheck/tests/unit/test_required_files.py +++ b/elastic_recheck/tests/unit/test_required_files.py @@ -24,10 +24,12 @@ class TestRequiredFiles(tests.TestCase): self.assertEqual(url, 'http://logs.openstack.org/13/46613/2/check/gate-tempest-devstack-vm-full/864bf44') + def _fake_urlopen(self, url): + pass + def test_files_at_url_pass(self): - self.mox.StubOutWithMock(urllib2, 'urlopen') + self.stubs.Set(urllib2, 'urlopen', self._fake_urlopen) result = elasticRecheck.RequiredFiles.files_at_url('http://logs.openstack.org/13/46613/2/check/gate-tempest-devstack-vm-full/864bf44') - self.mox.ReplayAll() self.assertTrue(result) def _invalid_url_open(self, url):