Revision a3accf03
b/snf-cyclades-app/synnefo/api/test/flavors.py | ||
---|---|---|
136 | 136 |
# XXX: flavors/22 below fails for no apparent reason |
137 | 137 |
response = self.myget('flavors/%d' % 23) |
138 | 138 |
self.assertItemNotFound(response) |
139 |
|
|
140 |
def test_catch_wrong_api_paths(self, *args): |
|
141 |
response = self.myget('nonexistent') |
|
142 |
self.assertEqual(response.status_code, 400) |
|
143 |
try: |
|
144 |
error = json.loads(response.content) |
|
145 |
except ValueError: |
|
146 |
self.assertTrue(False) |
b/snf-cyclades-app/synnefo/api/test/images.py | ||
---|---|---|
213 | 213 |
mimage.return_value.unregister.assert_called_once_with('42') |
214 | 214 |
mimage.return_value._delete.assert_not_called('42') |
215 | 215 |
|
216 |
@assert_backend_closed |
|
217 |
def test_catch_wrong_api_paths(self, *args): |
|
218 |
response = self.myget('nonexistent') |
|
219 |
self.assertEqual(response.status_code, 400) |
|
220 |
try: |
|
221 |
error = json.loads(response.content) |
|
222 |
except ValueError: |
|
223 |
self.assertTrue(False) |
|
224 |
|
|
216 | 225 |
|
217 | 226 |
@patch('synnefo.plankton.backend.ImageBackend') |
218 | 227 |
class ImageMetadataAPITest(ComputeAPITest): |
b/snf-cyclades-app/synnefo/api/test/networks.py | ||
---|---|---|
433 | 433 |
response = self.mypost('networks/%d/action' % net.id, |
434 | 434 |
net.userid, json.dumps(request), 'json') |
435 | 435 |
self.assertBadRequest(response) |
436 |
|
|
437 |
def test_catch_wrong_api_paths(self, *args): |
|
438 |
response = self.myget('nonexistent') |
|
439 |
self.assertEqual(response.status_code, 400) |
|
440 |
try: |
|
441 |
error = json.loads(response.content) |
|
442 |
except ValueError: |
|
443 |
self.assertTrue(False) |
b/snf-cyclades-app/synnefo/api/test/servers.py | ||
---|---|---|
189 | 189 |
self.assertSuccess(response) |
190 | 190 |
self.assertEqual(VirtualMachine.objects.get(id=vm.id).name, "new_name") |
191 | 191 |
|
192 |
def test_catch_wrong_api_paths(self): |
|
193 |
response = self.myget('nonexistent') |
|
194 |
self.assertEqual(response.status_code, 400) |
|
195 |
try: |
|
196 |
error = json.loads(response.content) |
|
197 |
except ValueError: |
|
198 |
self.assertTrue(False) |
|
199 |
|
|
192 | 200 |
|
193 | 201 |
@patch('synnefo.api.util.get_image') |
194 | 202 |
@patch('synnefo.logic.rapi_pool.GanetiRapiClient') |
b/snf-cyclades-app/synnefo/api/test/versions.py | ||
---|---|---|
36 | 36 |
from snf_django.utils.testing import astakos_user |
37 | 37 |
from synnefo.cyclades_settings import cyclades_services |
38 | 38 |
from synnefo.lib.services import get_service_path |
39 |
from synnefo.lib import join_urls |
|
40 |
|
|
39 | 41 |
|
40 | 42 |
class APITest(TestCase): |
41 | 43 |
def test_api_version(self): |
... | ... | |
48 | 50 |
api_version = json.loads(response.content)['version'] |
49 | 51 |
self.assertEqual(api_version['id'], 'v2.0') |
50 | 52 |
self.assertEqual(api_version['status'], 'CURRENT') |
53 |
|
|
54 |
def test_catch_wrong_api_paths(self, *args): |
|
55 |
path = get_service_path(cyclades_services, |
|
56 |
'compute', version='v2.0') |
|
57 |
response = self.client.get(join_urls(path, 'nonexistent')) |
|
58 |
self.assertEqual(response.status_code, 400) |
|
59 |
try: |
|
60 |
error = json.loads(response.content) |
|
61 |
except ValueError: |
|
62 |
self.assertTrue(False) |
Also available in: Unified diff