def test_get_loglines_good_hides_output():
    returncode = 0
    cmd = 'testcmd'
    output = 'goodoutput'
    args = Mock()
    args.commit = 'testcommit'
    args.clusterinstance = 'test-clusterinstance'
    actual = get_loglines(returncode=returncode, cmd=cmd, output=output, args=args)
    assert 'Marked %s in %s for deployment.' % (args.commit, args.clusterinstance) in actual
    assert 'Output: %s' % output not in actual
def test_get_loglines_bad_return_outputs_the_error():
    returncode = 1
    cmd = 'testcmd'
    output = 'BAD OUTPUT'
    args = Mock()
    args.commit = 'testcommit'
    args.clusterinstance = 'test-clusterinstance'
    actual = get_loglines(returncode=returncode, cmd=cmd, output=output, args=args)
    assert 'Output: %s' % output in actual
    assert "Ran: '%s'" % cmd in actual
    assert 'ERROR: Failed to mark %s for deployment in %s.' % (args.commit, args.clusterinstance) in actual
Esempio n. 3
0
def test_get_loglines_good_hides_output():
    returncode = 0
    cmd = 'testcmd'
    output = 'goodoutput'
    commit = 'testcommit'
    cluster = 'test-cluster'
    instance = 'test-instance'
    actual = get_loglines(returncode=returncode,
                          cmd=cmd,
                          output=output,
                          commit=commit,
                          cluster=cluster,
                          instance=instance)
    assert 'Marked %s in %s.%s for deployment.' % (commit, cluster,
                                                   instance) in actual
    assert 'Output: %s' % output not in actual
Esempio n. 4
0
def test_get_loglines_bad_return_outputs_the_error():
    returncode = 1
    cmd = 'testcmd'
    output = 'BAD OUTPUT'
    commit = 'testcommit'
    cluster = 'test-cluster'
    instance = 'test-instance'
    actual = get_loglines(returncode=returncode,
                          cmd=cmd,
                          output=output,
                          commit=commit,
                          cluster=cluster,
                          instance=instance)
    assert 'Output: %s' % output in actual
    assert "Ran: '%s'" % cmd in actual
    assert 'ERROR: Failed to mark %s for deployment in %s.%s.' % (
        commit, cluster, instance) in actual
def test_get_loglines_good_hides_output():
    returncode = 0
    cmd = 'testcmd'
    output = 'goodoutput'
    commit = 'testcommit'
    cluster = 'test-cluster'
    instance = 'test-instance'
    actual = get_loglines(
        returncode=returncode,
        cmd=cmd,
        output=output,
        commit=commit,
        cluster=cluster,
        instance=instance
    )
    assert 'Marked %s in %s.%s for deployment.' % (commit, cluster, instance) in actual
    assert 'Output: %s' % output not in actual
def test_get_loglines_bad_return_outputs_the_error():
    returncode = 1
    cmd = 'testcmd'
    output = 'BAD OUTPUT'
    commit = 'testcommit'
    cluster = 'test-cluster'
    instance = 'test-instance'
    actual = get_loglines(
        returncode=returncode,
        cmd=cmd,
        output=output,
        commit=commit,
        cluster=cluster,
        instance=instance
    )
    assert 'Output: %s' % output in actual
    assert "Ran: '%s'" % cmd in actual
    assert 'ERROR: Failed to mark %s for deployment in %s.%s.' % (commit, cluster, instance) in actual