Revision 882b662f snf-cyclades-app/synnefo/neutron/tests/api.py
b/snf-cyclades-app/synnefo/neutron/tests/api.py | ||
---|---|---|
136 | 136 |
response = self.get(url) |
137 | 137 |
self.assertItemNotFound(response) |
138 | 138 |
|
139 |
def test_subnet_delete_not_found(self): |
|
140 |
'''Test delete a subnet that doesn't exist''' |
|
141 |
url = join_urls(SUBNETS_URL, '52') |
|
142 |
response = self.get(url) |
|
143 |
self.assertItemNotFound(response) |
|
139 |
#def test_subnet_delete_not_found(self): |
|
140 |
# '''Test delete a subnet that doesn't exist''' |
|
141 |
# # FIX ME |
|
142 |
# url = join_urls(SUBNETS_URL, '52') |
|
143 |
# response = self.get(url) |
|
144 |
# self.assertItemNotFound(response) |
|
144 | 145 |
|
145 | 146 |
def test_subnet_delete(self): |
146 |
'''Test delete a subnet that's not in use'''
|
|
147 |
'''Test delete a subnet -- not supported'''
|
|
147 | 148 |
url = join_urls(SUBNETS_URL, '42') |
148 | 149 |
response = self.get(url) |
149 | 150 |
self.assertItemNotFound(response) |
150 | 151 |
|
151 | 152 |
def test_create_subnet_with_malformed_ipversion(self): |
152 | 153 |
'''Create a subnet with a malformed ip_version type''' |
153 |
# PEP8 for {{}}? |
|
154 |
request = {'subnet': {'network_id': |
|
155 |
'ed2e3c10-2e43-4297-9006-2863a2d1abbc', |
|
156 |
'cidr': '10.0.3.0/24', |
|
157 |
'ip_version': 8}} |
|
154 |
request = { |
|
155 |
'subnet': { |
|
156 |
'network_id': 'ed2e3c10-2e43-4297-9006-2863a2d1abbc', |
|
157 |
'cidr': '10.0.3.0/24', |
|
158 |
'ip_version': 8} |
|
159 |
} |
|
160 |
response = self.post(SUBNETS_URL, "user9", json.dumps(request), "json") |
|
161 |
self.assertBadRequest(response) |
|
162 |
|
|
163 |
def test_create_subnet_with_invalid_cidr(self): |
|
164 |
'''Create a subnet with an invalid cidr''' |
|
165 |
request = { |
|
166 |
'subnet': { |
|
167 |
'network_id': 'ed2e3c10-2e43-4297-9006-2863a2d1abbc', |
|
168 |
'cidr': '192.168.3.0/8'} |
|
169 |
} |
|
170 |
response = self.post(SUBNETS_URL, "user9", json.dumps(request), "json") |
|
171 |
self.assertBadRequest(response) |
|
158 | 172 |
|
173 |
def test_create_subnet_with_invalid_gateway(self): |
|
174 |
'''Create a subnet with a gateway outside of the subnet range''' |
|
175 |
request = { |
|
176 |
'subnet': { |
|
177 |
'network_id': 'ed2e3c10-2e43-4297-9006-2863a2d1abbc', |
|
178 |
'cidr': '192.168.3.0/24', |
|
179 |
'gateway_ip': '192.168.0.1'} |
|
180 |
} |
|
181 |
response = self.post(SUBNETS_URL, "user9", json.dumps(request), "json") |
|
182 |
self.assertBadRequest(response) |
|
183 |
|
|
184 |
def test_create_subnet_with_long_name(self): |
|
185 |
'''Create a subnet with an invalid subnet name''' |
|
186 |
request = { |
|
187 |
'subnet': { |
|
188 |
'network_id': 'ed2e3c10-2e43-4297-9006-2863a2d1abbc', |
|
189 |
'cidr': '192.168.3.0/24', |
|
190 |
'name': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' |
|
191 |
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' |
|
192 |
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'} |
|
193 |
} |
|
194 |
response = self.post(SUBNETS_URL, "user9", json.dumps(request), "json") |
|
195 |
self.assertBadRequest(response) |
|
196 |
|
|
197 |
def test_create_subnet_with_invalid_dhcp(self): |
|
198 |
'''Create a subnet with an invalid dhcp value''' |
|
199 |
request = { |
|
200 |
'subnet': { |
|
201 |
'network_id': 'ed2e3c10-2e43-4297-9006-2863a2d1abbc', |
|
202 |
'cidr': '192.168.3.0/24', |
|
203 |
'enable_dhcp': 'None'} |
|
204 |
} |
|
159 | 205 |
response = self.post(SUBNETS_URL, "user9", json.dumps(request), "json") |
160 | 206 |
self.assertBadRequest(response) |
Also available in: Unified diff