diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-05-17 08:10:01 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-05-17 08:43:07 +0200 |
commit | cbb2b65213c735d7cc02d94e27d8e5ba59760567 (patch) | |
tree | 29f8332f54ca7c30718a63f12d70789258c7a2a9 | |
parent | 264c6dc7934b34a689ed8a81523ed263559369eb (diff) |
tests: Don't rely on dict key ordering
so tests work reliably with python3
-rw-r--r-- | foremanhost.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/foremanhost.py b/foremanhost.py index c6bb3e7..2638387 100644 --- a/foremanhost.py +++ b/foremanhost.py @@ -119,8 +119,13 @@ def build_primary_interface(ipv4addr): """ Build a Foreman interface definition - >>> build_primary_interface('127.0.0.1') - {'0': {'ip': '127.0.0.1', 'provision': True, 'primary': True}} + >>> iface = build_primary_interface('127.0.0.1') + >>> iface['0']['ip'] + '127.0.0.1' + >>> iface['0']['provision'] + True + >>> iface['0']['primary'] + True """ if not ipv4addr: return None @@ -333,15 +338,17 @@ def param_by_name(name, params): 'fasel' >>> param_by_name("foo", [{"name": "bla", - ... "value": "fasel"}]) + ... "value": "fasel"}, + ... {"name": "bli", + ... "value": "bla"}]) Traceback (most recent call last): ... - ValueError: No Param with name foo found in [{'name': 'bla', 'value': 'fasel'}] + ValueError: No Param with name foo found in ['bla', 'bli'] """ for p in params: if p['name'] == name: return p - raise ValueError("No Param with name %s found in %s" % (name, params)) + raise ValueError("No Param with name %s found in %s" % (name, [n['name'] for n in params])) def add_param(hid, name, value): |