Updated Branches: refs/heads/trunk cd5731c9a -> ff6acd16b
Modify "use_param" functionality of MockHttp class to also work if provided param is no available in every request. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ca1104f2 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ca1104f2 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ca1104f2 Branch: refs/heads/trunk Commit: ca1104f24f581b215a2bfa895b7e5989e5d59e6f Parents: cd5731c Author: Tomaz Muraus <[email protected]> Authored: Tue Nov 5 11:51:17 2013 +0000 Committer: Tomaz Muraus <[email protected]> Committed: Tue Nov 5 13:29:08 2013 +0000 ---------------------------------------------------------------------- libcloud/test/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ca1104f2/libcloud/test/__init__.py ---------------------------------------------------------------------- diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py index cd09e42..3a701cd 100644 --- a/libcloud/test/__init__.py +++ b/libcloud/test/__init__.py @@ -115,11 +115,14 @@ class BaseMockHttpObject(object): def _get_method_name(self, type, use_param, qs, path): path = path.split('?')[0] meth_name = path.replace('/', '_').replace('.', '_').replace('-', '_') + if type: meth_name = '%s_%s' % (meth_name, self.type) - if use_param: - param = qs[self.use_param][0].replace('.', '_').replace('-', '_') + + if use_param and use_param in qs: + param = qs[use_param][0].replace('.', '_').replace('-', '_') meth_name = '%s_%s' % (meth_name, param) + return meth_name
