Revision 83157287

b/snf-cyclades-app/synnefo/api/tests/subnets.py
90 90
        }
91 91
        response = self.post(SUBNETS_URL, test_net.userid,
92 92
                             json.dumps(request), "json")
93
        self.assertSuccess(response)
93
        self.assertSuccess201(response)
94 94
        resp = json.loads(response.content)['subnet']
95 95
        self.assertEqual("10.0.3.1", resp['gateway_ip'])
96 96
        self.assertEqual([{"start": "10.0.3.2", "end": "10.0.3.254"}],
......
109 109
        }
110 110
        response = self.post(SUBNETS_URL, test_net.userid,
111 111
                             json.dumps(request), "json")
112
        self.assertSuccess(response)
112
        self.assertSuccess201(response)
113 113

  
114 114
    def test_create_subnet_success_ipv6_with_slaac(self):
115 115
        """Test create a subnet with ipv6 and slaac"""
......
123 123
        }
124 124
        response = self.post(SUBNETS_URL, test_net.userid,
125 125
                             json.dumps(request), "json")
126
        self.assertSuccess(response)
126
        self.assertSuccess201(response)
127 127
        resp = json.loads(response.content)['subnet']
128 128
        self.assertEqual("fdc1:4992:1130:fc0b::1", resp['gateway_ip'])
129 129
        self.assertEqual([], resp['allocation_pools'])
......
171 171
        }
172 172
        response = self.post(SUBNETS_URL, test_net.userid,
173 173
                             json.dumps(request), "json")
174
        self.assertSuccess(response)
174
        self.assertSuccess201(response)
175 175

  
176 176
    def test_create_subnet_with_multiple_ip_pools(self):
177 177
        """Test create a subnet with multiple IP pools"""
......
190 190
        }
191 191
        response = self.post(SUBNETS_URL, test_net.userid,
192 192
                             json.dumps(request), "json")
193
        self.assertSuccess(response)
193
        self.assertSuccess201(response)
194 194
        resp = json.loads(response.content)['subnet']
195 195
        self.assertEqual([{"start": "10.0.3.2", "end": "10.0.3.100"},
196 196
                          {"start": "10.0.3.200", "end": "10.0.3.220"}],
......
208 208
        }
209 209
        response = self.post(SUBNETS_URL, test_net.userid,
210 210
                             json.dumps(request), "json")
211
        self.assertSuccess(response)
211
        self.assertSuccess201(response)
212 212
        resp = json.loads(response.content)['subnet']
213 213
        self.assertEqual("10.0.3.150", resp['gateway_ip'])
214 214
        self.assertEqual([{"start": "10.0.3.1", "end": "10.0.3.149"},
......
390 390
        }
391 391
        response = self.post(SUBNETS_URL, test_net.userid, json.dumps(request),
392 392
                             "json")
393
        self.assertSuccess(response)
393
        self.assertSuccess201(response)
394 394

  
395 395
    def test_create_subnet_with_dns_nameservers(self):
396 396
        """Create a subnet with dns nameservers"""
......
403 403
        }
404 404
        response = self.post(SUBNETS_URL, test_net.userid, json.dumps(request),
405 405
                             "json")
406
        self.assertSuccess(response)
406
        self.assertSuccess201(response)
407 407

  
408 408
    def test_create_subnet_with_host_routes(self):
409 409
        """Create a subnet with dns nameservers"""
......
416 416
        }
417 417
        response = self.post(SUBNETS_URL, test_net.userid, json.dumps(request),
418 418
                             "json")
419
        self.assertSuccess(response)
419
        self.assertSuccess201(response)
420 420
        resp = json.loads(response.content)['subnet']
421 421
        self.assertEqual(["8.8.8.8", "1.1.1.1"], resp["host_routes"])
422 422

  
b/snf-django-lib/snf_django/utils/testing.py
247 247
    def assertSuccess(self, response):
248 248
        self.assertTrue(response.status_code in [200, 202, 203, 204])
249 249

  
250
    def assertSuccess201(self, response):
251
        self.assertEqual(response.status_code, 201)
252

  
250 253
    def assertFault(self, response, status_code, name):
251 254
        self.assertEqual(response.status_code, status_code)
252 255
        fault = json.loads(response.content)

Also available in: Unified diff