diff options
author | Naveed Massjouni <naveedm9@gmail.com> | 2011-02-16 19:37:28 -0500 |
---|---|---|
committer | Naveed Massjouni <naveedm9@gmail.com> | 2011-02-16 19:37:28 -0500 |
commit | 56ad2a63f1dcf4a900fa4464671015dbaac05fdc (patch) | |
tree | 776a70da7513a123373c3741d929713a5df8dea4 | |
parent | ce847afcc1e24463d7aa522f227a08193c72fcc0 (diff) | |
download | nova-56ad2a63f1dcf4a900fa4464671015dbaac05fdc.tar.gz nova-56ad2a63f1dcf4a900fa4464671015dbaac05fdc.tar.xz nova-56ad2a63f1dcf4a900fa4464671015dbaac05fdc.zip |
Minor change. Adding a helper function stub_instance() inside the test
test_get_all_server_details_with_host for readability.
-rw-r--r-- | nova/tests/api/openstack/test_servers.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py index 6c91b3f5b..630e1e5eb 100644 --- a/nova/tests/api/openstack/test_servers.py +++ b/nova/tests/api/openstack/test_servers.py @@ -55,7 +55,7 @@ def instance_address(context, instance_id): return None -def stub_instance(id, user_id=1, with_hosts=False): +def stub_instance(id, user_id=1): return Instance(id=id, state=0, image_id=10, user_id=user_id, display_name='server%s' % id) @@ -242,11 +242,13 @@ class ServersTest(unittest.TestCase): instances - 2 on one host and 3 on another. ''' + def stub_instance(id, user_id=1): + return Instance(id=id, state=0, image_id=10, user_id=user_id, + display_name='server%s' % id, host='host%s' % (id % 2)) + def return_servers_with_host(context, user_id=1): - return [ - Instance(id=i, state=0, image_id=10, user_id=user_id, - display_name='server%s' % i, host='host%s' % (i % 2)) - for i in xrange(5)] + return [stub_instance(i) for i in xrange(5)] + self.stubs.Set(nova.db.api, 'instance_get_all_by_user', return_servers_with_host) |