cleaned up instances of MultipleTimes

Change-Id: I9bae9e293fe9fccce0a722709945db8f8a2a09ea
Implements: blueprint multiple-times-in-tests
This commit is contained in:
Tzu-Mainn Chen 2013-09-05 10:31:18 -04:00
parent 1861547b72
commit cffde007d0
2 changed files with 40 additions and 9 deletions

View File

@ -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())

View File

@ -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