X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=tests%2Fintegration%2Ftest_controller.py;h=6423a98892c6b43b39322a84a65bfe8b3949e830;hb=HEAD;hp=f3840cc4f6fd10c671753630cd8be185207fad26;hpb=dcdf82bbc1ef310379f746518b2dd3b006353cb3;p=osm%2FN2VC.git diff --git a/tests/integration/test_controller.py b/tests/integration/test_controller.py deleted file mode 100644 index f3840cc..0000000 --- a/tests/integration/test_controller.py +++ /dev/null @@ -1,77 +0,0 @@ -import pytest -import uuid - -from .. import base -from juju.controller import Controller -from juju.errors import JujuAPIError - - -@base.bootstrapped -@pytest.mark.asyncio -async def test_add_user(event_loop): - async with base.CleanController() as controller: - username = 'test{}'.format(uuid.uuid4()) - await controller.add_user(username) - result = await controller.get_user(username) - res_ser = result.serialize()['results'][0].serialize() - assert res_ser['result'] is not None - - -@base.bootstrapped -@pytest.mark.asyncio -async def test_disable_enable_user(event_loop): - async with base.CleanController() as controller: - username = 'test-disable{}'.format(uuid.uuid4()) - await controller.add_user(username) - await controller.disable_user(username) - result = await controller.get_user(username) - res_ser = result.serialize()['results'][0].serialize() - assert res_ser['result'].serialize()['disabled'] is True - await controller.enable_user(username) - result = await controller.get_user(username) - res_ser = result.serialize()['results'][0].serialize() - assert res_ser['result'].serialize()['disabled'] is False - - -@base.bootstrapped -@pytest.mark.asyncio -async def test_change_user_password(event_loop): - async with base.CleanController() as controller: - username = 'test-password{}'.format(uuid.uuid4()) - await controller.add_user(username) - await controller.change_user_password(username, 'password') - try: - new_controller = Controller() - await new_controller.connect( - controller.connection.endpoint, username, 'password') - result = True - await new_controller.disconnect() - except JujuAPIError: - result = False - assert result is True - - -@base.bootstrapped -@pytest.mark.asyncio -async def test_grant(event_loop): - async with base.CleanController() as controller: - username = 'test-grant{}'.format(uuid.uuid4()) - await controller.add_user(username) - await controller.grant(username, 'superuser') - result = await controller.get_user(username) - result = result.serialize()['results'][0].serialize()['result']\ - .serialize() - assert result['access'] == 'superuser' - await controller.grant(username, 'login') - result = await controller.get_user(username) - result = result.serialize()['results'][0].serialize()['result']\ - .serialize() - assert result['access'] == 'login' - - -@base.bootstrapped -@pytest.mark.asyncio -async def test_get_models(event_loop): - async with base.CleanController() as controller: - result = await controller.get_models() - assert isinstance(result.serialize()['user-models'], list)