Revision fef04862 snf-cyclades-app/synnefo/api/tests/subnets.py
b/snf-cyclades-app/synnefo/api/tests/subnets.py | ||
---|---|---|
196 | 196 |
{"start": "10.0.3.200", "end": "10.0.3.220"}], |
197 | 197 |
resp['allocation_pools']) |
198 | 198 |
|
199 |
def test_create_subnet_with_gateway(self): |
|
200 |
"""Test create a subnet with a gateway""" |
|
201 |
test_net = mf.NetworkFactory() |
|
202 |
request = { |
|
203 |
'subnet': { |
|
204 |
'network_id': test_net.id, |
|
205 |
'cidr': '10.0.3.0/24', |
|
206 |
'ip_version': 4, |
|
207 |
'gateway_ip': '10.0.3.150'} |
|
208 |
} |
|
209 |
response = self.post(SUBNETS_URL, test_net.userid, |
|
210 |
json.dumps(request), "json") |
|
211 |
self.assertSuccess(response) |
|
212 |
resp = json.loads(response.content)['subnet'] |
|
213 |
self.assertEqual("10.0.3.150", resp['gateway_ip']) |
|
214 |
self.assertEqual([{"start": "10.0.3.1", "end": "10.0.3.149"}, |
|
215 |
{"start": "10.0.3.151", "end": "10.0.3.254"}], |
|
216 |
resp['allocation_pools']) |
|
217 |
|
|
199 | 218 |
def test_create_subnet_with_gateway_inside_of_ip_pool_range(self): |
200 |
"""Test create a subnet with an IP pool outside of network range"""
|
|
219 |
"""Test create a subnet with a gateway IP inside the IP pool range"""
|
|
201 | 220 |
test_net = mf.NetworkFactory() |
202 | 221 |
request = { |
203 | 222 |
'subnet': { |
Also available in: Unified diff