Removing the subnets from shared networks

RM8483

Created regression in the test_networks suite. Can only test 'getting' a
shared net here. It isn't possible, without modifications to the mock, to test
'not getting' a shared net. I considered modifying the mock but then all these
tests would pretty much be testing my new mock instead of actual things.

All this is supposed to do is ensure that, if a network is shared, the subnets
are not included in the output.

Updated the not shared check to ensure correctness.
This commit is contained in:
Justin Hammond
2014-08-20 14:28:21 -05:00
parent 6414453acd
commit d8090cf51c
2 changed files with 54 additions and 15 deletions

View File

@@ -54,11 +54,14 @@ def _make_network_dict(network, fields=None):
"ipam_strategy": network.get("ipam_strategy"),
"status": "ACTIVE",
"shared": shared_net}
if fields and "all_subnets" in fields:
res["subnets"] = [_make_subnet_dict(s)
for s in network.get("subnets", [])]
if not shared_net:
if fields and "all_subnets" in fields:
res["subnets"] = [_make_subnet_dict(s)
for s in network.get("subnets", [])]
else:
res["subnets"] = [s["id"] for s in network.get("subnets", [])]
else:
res["subnets"] = [s["id"] for s in network.get("subnets", [])]
res["subnets"] = []
return res