Using fixtures instead of deprecated mockpatch module
This module mockpatch of oslotest[1] is deprecated since version 1.13 and may be removed in version 2.0. Use fixtures.Mock* classes instead[2] [1]OpenStack Testing Framework and Utilities [2]https://docs.openstack.org/developer/oslotest/api/oslotest.mockpatch.html#module-oslotest.mockpatch Change-Id: I91a8593902241427296563813703009a232cf0e3
This commit is contained in:
parent
287ac21f16
commit
09f39db48e
|
@ -10,11 +10,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
|
||||
import fixtures
|
||||
import json
|
||||
import mock
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
import requests_mock
|
||||
|
||||
from releasetools import update_reviews
|
||||
|
@ -28,8 +28,8 @@ class TestUpdateReviews(base.BaseTestCase):
|
|||
'password': mock.sentinel.password,
|
||||
'url': 'https://review.openstack.org/',
|
||||
}
|
||||
po = mockpatch.PatchObject(update_reviews, '_read_config',
|
||||
return_value=fake_conf)
|
||||
po = fixtures.MockPatchObject(update_reviews, '_read_config',
|
||||
return_value=fake_conf)
|
||||
self.useFixture(po)
|
||||
|
||||
def test_update_my_reviews(self):
|
||||
|
@ -37,12 +37,12 @@ class TestUpdateReviews(base.BaseTestCase):
|
|||
u_r = update_reviews.UpdateReviews(mock.sentinel.project)
|
||||
|
||||
sample_reviews = [mock.sentinel.r1, mock.sentinel.r2]
|
||||
po = mockpatch.PatchObject(u_r, '_list_my_reviews',
|
||||
return_value=sample_reviews)
|
||||
po = fixtures.MockPatchObject(u_r, '_list_my_reviews',
|
||||
return_value=sample_reviews)
|
||||
list_my_reviews_mock = self.useFixture(po).mock
|
||||
|
||||
update_review_mock = self.useFixture(
|
||||
mockpatch.PatchObject(u_r, '_update_review')).mock
|
||||
fixtures.MockPatchObject(u_r, '_update_review')).mock
|
||||
|
||||
u_r.update_my_reviews()
|
||||
|
||||
|
@ -58,12 +58,12 @@ class TestUpdateReviews(base.BaseTestCase):
|
|||
updating_review_cb=cb)
|
||||
|
||||
sample_reviews = [mock.sentinel.r1, mock.sentinel.r2]
|
||||
po = mockpatch.PatchObject(u_r, '_list_my_reviews',
|
||||
return_value=sample_reviews)
|
||||
po = fixtures.MockPatchObject(u_r, '_list_my_reviews',
|
||||
return_value=sample_reviews)
|
||||
self.useFixture(po).mock
|
||||
|
||||
self.useFixture(
|
||||
mockpatch.PatchObject(u_r, '_update_review')).mock
|
||||
fixtures.MockPatchObject(u_r, '_update_review')).mock
|
||||
|
||||
u_r.update_my_reviews()
|
||||
|
||||
|
|
Loading…
Reference in New Issue