<commit_before># Copyright (c) 2012 - 2014 <NAME>, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.

from jenkinsflow.flow import serial
from .framework import mock_api


def test_direct_url(capsys):
    with mock_api.api(__file__) as api:
        api.job('j1', 0.01, max_fails=0, expect_invocations=1, expect_order=1, params=(('s1', 'Hi', 'desc'), ('c1', ('true', 'maybe', 'false'), 'desc')))
        api.job('j2', 0.01, max_fails=0, expect_invocations=1, expect_order=2, serial=True)

        with serial(api, timeout=40, job_name_prefix=api.job_name_prefix, report_interval=1, direct_url=api.baseurl) as ctrl:
            ctrl.invoke('j1', s1='HELLO', c1=True)
            ctrl.invoke('j2')

    if api.baseurl == "http://localhost:8080":
        sout, _ = capsys.readouterr()
        print sout
        assert api.baseurl not in sout
    assert '//job' not in sout
    assert '/job/' in sout


def test_direct_url_trailing_slash(capsys):
    with mock_api.api(__file__) as api:
        api.job('j1', 0.01, max_fails=0, expect_invocations=1, expect_order=1, params=(('s1', 'Hi', 'desc'),))
        api.job('j2', 0.01, max_fails=0, expect_invocations=1, expect_order=2, serial=True)

        with serial(api, timeout=40, job_name_prefix=api.job_name_prefix, report_interval=1, direct_url=api.baseurl + '/') as ctrl:
            ctrl.invoke('j1', s1='HELLO')
            ctrl.invoke('j2')

    if api.baseurl == "http://localhost:8080":
        sout, _ = capsys.readouterr()
        print sout
        assert api.baseurl not in sout
    assert '//job' not in sout
    assert '/job/' in sout<commit_msg>Corrected test if baseurl different from 'http://localhost:8080'<commit_after># Copyright (c) 2012 - 2014 <NAME>, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.

from jenkinsflow.flow import serial
from .framework import mock_api


def test_direct_url(capsys):
    with mock_api.api(__file__) as api:
        api.job('j1', 0.01, max_fails=0, expect_invocations=1, expect_order=1, params=(('s1', 'Hi', 'desc'), ('c1', ('true', 'maybe', 'false'), 'desc')))
        api.job('j2', 0.01, max_fails=0, expect_invocations=1, expect_order=2, serial=True)

        with serial(api, timeout=40, job_name_prefix=api.job_name_prefix, report_interval=1, direct_url=api.baseurl) as ctrl:
            ctrl.invoke('j1', s1='HELLO', c1=True)
            ctrl.invoke('j2')

    sout, _ = capsys.readouterr()
    print sout
    if api.baseurl == "http://localhost:8080":
        assert api.baseurl not in sout
    assert '//job' not in sout
    assert '/job/' in sout


def test_direct_url_trailing_slash(capsys):
    with mock_api.api(__file__) as api:
        api.job('j1', 0.01, max_fails=0, expect_invocations=1, expect_order=1, params=(('s1', 'Hi', 'desc'),))
        api.job('j2', 0.01, max_fails=0, expect_invocations=1, expect_order=2, serial=True)

        with serial(api, timeout=40, job_name_prefix=api.job_name_prefix, report_interval=1, direct_url=api.baseurl + '/') as ctrl:
            ctrl.invoke('j1', s1='HELLO')
            ctrl.invoke('j2')

    sout, _ = capsys.readouterr()
    print sout
    if api.baseurl == "http://localhost:8080":
        assert api.baseurl not in sout
    assert '//job' not in sout
    assert '/job/' in sout
{'fraction_non_alphanumeric': 0.14841628959276018, 'fraction_numerical': 0.03740573152337858, 'mean_word_length': 3.4629878869448185, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2608416', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1148, 'n_words': 281}