From cffde007d061cb2e210daef4b5d6f193a4331788 Mon Sep 17 00:00:00 2001 From: Tzu-Mainn Chen Date: Thu, 5 Sep 2013 10:31:18 -0400 Subject: [PATCH] cleaned up instances of MultipleTimes Change-Id: I9bae9e293fe9fccce0a722709945db8f8a2a09ea Implements: blueprint multiple-times-in-tests --- .../resource_management/racks/tests.py | 4 +- .../resource_classes/tests.py | 45 ++++++++++++++++--- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/tuskar_ui/infrastructure/resource_management/racks/tests.py b/tuskar_ui/infrastructure/resource_management/racks/tests.py index e8ba1baab..87408d057 100644 --- a/tuskar_ui/infrastructure/resource_management/racks/tests.py +++ b/tuskar_ui/infrastructure/resource_management/racks/tests.py @@ -93,7 +93,7 @@ class RackViewTests(test.BaseAdminViewTests): rack = self.tuskar_racks.first() tuskar.Rack.get( - mox.IsA(http.HttpRequest), rack.id).MultipleTimes().AndReturn(rack) + mox.IsA(http.HttpRequest), rack.id).AndReturn(rack) tuskar.ResourceClass.list( mox.IsA(http.request.HttpRequest)).AndReturn( self.tuskar_resource_classes.list()) @@ -126,7 +126,7 @@ class RackViewTests(test.BaseAdminViewTests): 'cpus': u'1', 'memory_mb': u'1024', 'local_gb': u'10'} tuskar.Rack.get( - mox.IsA(http.HttpRequest), rack.id).MultipleTimes().AndReturn(rack) + mox.IsA(http.HttpRequest), rack.id).AndReturn(rack) tuskar.Rack.list( mox.IsA(http.request.HttpRequest)).AndReturn( self.tuskar_racks.list()) diff --git a/tuskar_ui/infrastructure/resource_management/resource_classes/tests.py b/tuskar_ui/infrastructure/resource_management/resource_classes/tests.py index b2d8e9a5e..fd26cbaef 100644 --- a/tuskar_ui/infrastructure/resource_management/resource_classes/tests.py +++ b/tuskar_ui/infrastructure/resource_management/resource_classes/tests.py @@ -126,8 +126,17 @@ class ResourceClassViewTests(test.BaseAdminViewTests): tuskar.ResourceClass.get( mox.IsA(http.HttpRequest), - resource_class.id).MultipleTimes().AndReturn( - resource_class) + resource_class.id).AndReturn(resource_class) + + # get_flavors_data in workflows.py + tuskar.ResourceClass.get( + mox.IsA(http.HttpRequest), + resource_class.id).AndReturn(resource_class) + + # get_racks_data in workflows.py + tuskar.ResourceClass.get( + mox.IsA(http.HttpRequest), + resource_class.id).AndReturn(resource_class) self.mox.ReplayAll() @@ -152,7 +161,7 @@ class ResourceClassViewTests(test.BaseAdminViewTests): resource_class = self.tuskar_resource_classes.first() tuskar.ResourceClass.\ - get(mox.IsA(http.HttpRequest), resource_class.id).MultipleTimes()\ + get(mox.IsA(http.HttpRequest), resource_class.id)\ .AndRaise(self.exceptions.tuskar) self.mox.ReplayAll() @@ -263,7 +272,7 @@ class ResourceClassViewTests(test.BaseAdminViewTests): tuskar.ResourceClass.get( mox.IsA(http.HttpRequest), resource_class.id).\ - MultipleTimes().AndReturn(resource_class) + AndReturn(resource_class) self.mox.ReplayAll() tuskar.ResourceClass.list_flavors = flavors @@ -358,7 +367,7 @@ class ResourceClassViewTests(test.BaseAdminViewTests): tuskar.ResourceClass.get( mox.IsA(http.HttpRequest), resource_class.id).\ - MultipleTimes().AndRaise(self.exceptions.tuskar) + AndRaise(self.exceptions.tuskar) self.mox.ReplayAll() url = urlresolvers.reverse( @@ -379,7 +388,18 @@ class ResourceClassViewTests(test.BaseAdminViewTests): tuskar.ResourceClass.get(mox.IsA(http.HttpRequest), resource_class.id).\ - MultipleTimes().AndReturn(resource_class) + AndReturn(resource_class) + + # get_flavors_data in workflows.py + tuskar.ResourceClass.get( + mox.IsA(http.HttpRequest), + resource_class.id).AndReturn(resource_class) + + # get_racks_data in workflows.py + tuskar.ResourceClass.get( + mox.IsA(http.HttpRequest), + resource_class.id).AndReturn(resource_class) + self.mox.ReplayAll() # FIXME I should probably track the racks and flavors methods @@ -448,7 +468,18 @@ class ResourceClassViewTests(test.BaseAdminViewTests): tuskar.ResourceClass.get(mox.IsA(http.HttpRequest), resource_class.id).\ - MultipleTimes().AndReturn(resource_class) + AndReturn(resource_class) + + # get_flavors_data in workflows.py + tuskar.ResourceClass.get( + mox.IsA(http.HttpRequest), + resource_class.id).AndReturn(resource_class) + + # get_racks_data in workflows.py + tuskar.ResourceClass.get( + mox.IsA(http.HttpRequest), + resource_class.id).AndReturn(resource_class) + self.mox.ReplayAll() # FIXME I should probably track the racks and flavors methods