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)
Exemple #2
0
 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 #3
0
 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 #4
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 #5
0
def neoload_login(request, monkeypatch):
    token = request.config.getoption('--token')
    api_url = request.config.getoption('--url')
    runner = CliRunner()
    result_status = runner.invoke(status)
    # do login if not already logged-in with the right credentials
    if "aren't logged in" in result_status.output \
            or api_url not in result_status.output \
            or '*' * (len(token) - 3) + token[-3:] not in result_status.output:
        mock_login_get_urls(monkeypatch)
        runner.invoke(login, [token, '--url', api_url])
        print('\n@Before : %s' % str(runner.invoke(status).output))
    else:
        print('\n@Before : Already logged on %s' % api_url)
Exemple #6
0
def neoload_login(request, monkeypatch):
    token = request.config.getoption('--token')
    api_url = request.config.getoption('--url')
    workspace = request.config.getoption('--workspace')
    runner = CliRunner()
    result_status = runner.invoke(status)
    # do login if not already logged-in with the right credentials
    if "aren't logged in" in result_status.output \
            or "No settings is stored" in result_status.output \
            or api_url not in result_status.output \
            or '*' * (len(token) - 3) + token[-3:] not in result_status.output:
        mock_login_get_urls(monkeypatch)
        cli_options = [token, '--url', api_url]
        if workspace and len(workspace) > 0:
            cli_options.extend(['--workspace', workspace])
        runner.invoke(login, cli_options)
    else:
        print('\n@Before : Already logged on %s' % api_url)