Example #1
0
def test_parse_single_string_conf(app):
    spec = Specification.parse({
        'service': 'redis-server',
        'script': 'ls',
        'after_success': 'pwd',
        'after_failure': 'exit',
        'notification': {
            'email': {
                'recipients': '*****@*****.**',
                'on_success': 'always',
            },
            'slack_webhook': {
                'webhooks': ['https://1', 'https://2'],
                'on_failure': 'never',
            }
        }
    })
    assert spec.services == ['redis-server']
    assert spec.scripts == ['ls']
    assert spec.after_success == ['pwd']
    assert spec.after_failure == ['exit']
    assert spec.notification.email.recipients == ['*****@*****.**']
    assert spec.notification.email.on_success == 'always'
    assert spec.notification.email.on_failure == 'always'
    assert len(spec.notification.slack_webhook.webhooks) == 2
    assert spec.notification.slack_webhook.on_success == 'always'
    assert spec.notification.slack_webhook.on_failure == 'never'
Example #2
0
def test_parse_empty_conf():
    spec = Specification.parse({})
    assert len(spec.scripts) == 0
    assert len(spec.services) == 0
    assert len(spec.after_success) == 0
    assert len(spec.after_failure) == 0
    assert len(spec.branch) == 0
    assert spec.dockerfile == 'Dockerfile'
    assert len(spec.notification.emails) == 0
Example #3
0
def test_parse_single_string_conf():
    spec = Specification.parse({
        'service': 'redis-server',
        'script': 'ls',
        'after_success': 'pwd',
        'after_failure': 'exit',
        'notification': {
            'email': '*****@*****.**',
        }
    })
    assert spec.services == ['redis-server']
    assert spec.scripts == ['ls']
    assert spec.after_success == ['pwd']
    assert spec.after_failure == ['exit']
    assert spec.notification.emails == ['*****@*****.**']