Exemplo n.º 1
0
def test_embedded_app_flag():
    res = [
        p
        for p in traverse.scan_for_protocols(data_path)
        if p['flags'] and p['flags']['embedded-app']
    ]

    expected = [
        {
            'slug': 'protocolApp',
            'path': os.path.join(data_path, 'protocolApp'),
            'detected-files': {
                'protocol': [],
                'description': ['README.md'],
            },
            'flags': {
                'ignore': False,
                'feature': False,
                'skip-tests': False,
                'embedded-app': 'http://blah.aws.s3/something/app.html'
            },
        }
    ]

    assert res == expected
Exemplo n.º 2
0
def test_protocol_ignore():
    res = [
        p for p in traverse.scan_for_protocols(data_path)
        if p['flags']['ignore']
    ]

    expected = [{
        'slug': 'protocol3',
        'path': os.path.join(data_path, 'protocol3'),
        'detected-files': {
            'OT 1 protocol': ['protocol.ot1.py'],
            'OT 2 protocol': ['protocol.ot2.py'],
            'description': ['README.md'],
        },
        'flags': {
            'ignore': True,
            'feature': False,
            'skip-tests': False,
            'embedded-app': False
        },
    }]
    assert res == expected

    found_protocols = [p for p in traverse.scan(data_path)]
    slugs = [p['slug'] for p in found_protocols]
    assert not any(['protocol3' in s for s in slugs])
Exemplo n.º 3
0
def get_protocols_by_flag(flag, dir_path):
    protocols = list(traverse.scan_for_protocols(dir_path))
    return [
        protocol
        for protocol in protocols
        if flag in protocol['flags'] and
        protocol['flags'][flag] is True
    ]