Revision 9582e68e snf-cyclades-app/synnefo/api/tests/floating_ips.py
b/snf-cyclades-app/synnefo/api/tests/floating_ips.py | ||
---|---|---|
111 | 111 |
self.assertEqual(ip.network, net) |
112 | 112 |
self.assertEqual(json.loads(response.content)["floating_ip"], |
113 | 113 |
{"instance_id": None, "ip": "192.168.2.1", |
114 |
"fixed_ip": None, "id": "1", "pool": "1"}) |
|
114 |
"fixed_ip": None, "id": str(ip.id), |
|
115 |
"pool": str(net.id)}) |
|
115 | 116 |
|
116 | 117 |
def test_reserve_no_pool(self): |
117 | 118 |
# No networks |
... | ... | |
132 | 133 |
with mocked_quotaholder(): |
133 | 134 |
response = self.post(URL, "test_user", json.dumps({}), "json") |
134 | 135 |
self.assertSuccess(response) |
136 |
ip = FloatingIP.objects.get() |
|
135 | 137 |
self.assertEqual(json.loads(response.content)["floating_ip"], |
136 | 138 |
{"instance_id": None, "ip": "192.168.2.1", |
137 |
"fixed_ip": None, "id": "1", "pool": str(net2.id)}) |
|
139 |
"fixed_ip": None, "id": str(ip.id), |
|
140 |
"pool": str(net2.id)}) |
|
138 | 141 |
|
139 | 142 |
def test_reserve_full(self): |
140 | 143 |
net = FloatingIPPoolFactory(userid="test_user", |
... | ... | |
151 | 154 |
with mocked_quotaholder(): |
152 | 155 |
response = self.post(URL, "test_user", json.dumps(request), "json") |
153 | 156 |
self.assertSuccess(response) |
157 |
ip = FloatingIP.objects.get() |
|
154 | 158 |
self.assertEqual(json.loads(response.content)["floating_ip"], |
155 | 159 |
{"instance_id": None, "ip": "192.168.2.10", |
156 |
"fixed_ip": None, "id": "1", "pool": "1"}) |
|
160 |
"fixed_ip": None, "id": str(ip.id), "pool": |
|
161 |
str(net.id)}) |
|
157 | 162 |
|
158 | 163 |
# Already reserved |
159 | 164 |
FloatingIPFactory(network=net, ipv4="192.168.2.3") |
Also available in: Unified diff