Exemple #1
0
 def test_logout(self, monkeypatch):
     mock_login_get_urls(monkeypatch)
     user_data.do_login('some token', 'some url', False)
     user_data.do_logout()
     with pytest.raises(click.ClickException) as context:
         user_data.get_user_data()
     assert 'You are\'nt logged. Please use command "neoload login" first' in str(
         context.value)
 def test_logout(self, monkeypatch, request):
     mock_login_get_urls(monkeypatch)
     token = request.config.getoption('--token')
     api_url = request.config.getoption('--url')
     user_data.do_login(token, api_url, False)
     user_data.do_logout()
     with pytest.raises(click.ClickException) as context:
         user_data.get_user_data()
     assert 'You aren\'t logged. Please use command "neoload login" first' in str(
         context.value)
Exemple #3
0
def cli(token, url, no_write, workspace):
    """Store your token and API url of NeoLoad Web. The token is read from stdin if none is set.
    The default API url is "https://neoload-api.saas.neotys.com/" """
    if not token:
        if sys.stdin.isatty():
            token = click.prompt("Enter your token", None, True)
        else:
            token = input()
    url = url.strip()
    if url[-1] != '/':
        url += '/'

    __user_data = user_data.do_login(token, url, no_write)

    if workspace is not None:
        if user_data.is_version_lower_than('2.5.0'):
            print(
                "WARNING: The workspace option works only since Neoload Web 2.5.0. The specified workspace is ignored."
            )
        else:
            is_workspace_id = tools.is_mongodb_id(workspace)
            __id = tools.get_id(workspace, workspaces.__resolver,
                                is_workspace_id)
            tools.use(__id, workspaces.meta_key, workspaces.__resolver)

    if sys.stdin.isatty():
        print(__user_data)
 def test_login(self, monkeypatch, request):
     mock_login_get_urls(monkeypatch)
     token = request.config.getoption('--token')
     api_url = request.config.getoption('--url')
     login = user_data.do_login(token, api_url, False)
     assert login.token == user_data.get_user_data().token
     assert login.url == user_data.get_user_data().url
     assert user_data.get_user_data().token == token
     assert user_data.get_user_data().url == api_url
Exemple #5
0
 def test_login(self, monkeypatch):
     mock_login_get_urls(monkeypatch)
     login = user_data.do_login(
         'abcdefghf201df15d897e7afe99a24159da764c7cc82b2ab',
         'https://preprod-neoload.saas.neotys.com/', False)
     assert login.token == user_data.get_user_data().token
     assert login.url == user_data.get_user_data().url
     assert user_data.get_user_data(
     ).token == 'abcdefghf201df15d897e7afe99a24159da764c7cc82b2ab'
     assert user_data.get_user_data(
     ).url == 'https://preprod-neoload.saas.neotys.com/'
Exemple #6
0
def cli(token, url, no_write):
    """Store your token and uri of NeoLoad Web. The token is read from stdin if none is set.
    The default url is "https://neoload-api.saas.neotys.com/" """
    if not token:
        if sys.stdin.isatty():
            token = click.prompt("Enter your token", None, True)
        else:
            token = input()

    __user_data = user_data.do_login(token, url, no_write)
    if sys.stdin.isatty():
        print(__user_data)
 def test_login_without_token(self):
     with pytest.raises(Exception) as context:
         user_data.do_login(None, 'some url', False)
     assert 'token is mandatory. please see neoload login --help.' in str(
         context.value)