Revision 44a90141 snf-astakos-app/astakos/im/tests/api.py

b/snf-astakos-app/astakos/im/tests/api.py
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33 33

  
34
from astakos.im.tests.common import *
34
from astakos.im.tests.common import (
35
    astakos_settings, Client, Component, register, get_local_user, quotas,
36
    AstakosUser, Service, Endpoint, assertIn, activation_backends)
37

  
35 38
from astakos.im.settings import astakos_services, BASE_HOST
36 39
from synnefo.lib.services import get_service_path
37 40
from synnefo.lib import join_urls
......
335 338
        self.assertEqual(r.status_code, 200)
336 339

  
337 340
        reject_data = {'reject': ""}
338
        post_data = json.dumps(accept_data)
341
        post_data = json.dumps(reject_data)
339 342
        r = client.post(u('commissions/' + str(serial) + '/action'), post_data,
340 343
                        content_type='application/json', **s1_headers)
341 344
        self.assertEqual(r.status_code, 404)
......
402 405
        s1.save()
403 406
        e1 = Endpoint(service=s1)
404 407
        e1.save()
405
        e1.data.create(key='versionId', value='v1.0')
408
        e1.data.create(key='versionId', value='1.0')
406 409
        e1.data.create(key='publicURL', value='http://localhost:8000/s1/v1.0')
407 410

  
408 411
        s2 = Service(component=c1, type='type2', name='service2')
409 412
        s2.save()
410 413
        e2 = Endpoint(service=s2)
411 414
        e2.save()
412
        e2.data.create(key='versionId', value='v1.0')
415
        e2.data.create(key='versionId', value='1.0')
413 416
        e2.data.create(key='publicURL', value='http://localhost:8000/s2/v1.0')
414 417

  
415 418
        c2 = Component(name='component2', url='http://localhost/component2')
......
418 421
        s3.save()
419 422
        e3 = Endpoint(service=s3)
420 423
        e3.save()
421
        e3.data.create(key='versionId', value='v2.0')
424
        e3.data.create(key='versionId', value='2.0')
422 425
        e3.data.create(key='publicURL', value='http://localhost:8000/s3/v2.0')
423 426

  
424 427
    def test_authenticate(self):
......
585 588

  
586 589
class WrongPathAPITest(TestCase):
587 590
    def test_catch_wrong_account_paths(self, *args):
588
        path = get_service_path(astakos_services, 'account', 'v1.0')
591
        path = get_service_path(astakos_services, 'account', '1.0')
589 592
        path = join_urls(BASE_HOST, path, 'nonexistent')
590 593
        response = self.client.get(path)
591 594
        self.assertEqual(response.status_code, 400)
592 595
        try:
593
            error = json.loads(response.content)
596
            json.loads(response.content)
594 597
        except ValueError:
595 598
            self.assertTrue(False)
596 599

  
597 600
    def test_catch_wrong_identity_paths(self, *args):
598
        path = get_service_path(astakos_services, 'identity', 'v2.0')
601
        path = get_service_path(astakos_services, 'identity', '2.0')
599 602
        path = join_urls(BASE_HOST, path, 'nonexistent')
600 603
        response = self.client.get(path)
601 604
        self.assertEqual(response.status_code, 400)

Also available in: Unified diff