Пример #1
0
def test_rolemixin__build_doc():
    obj = RoleMixin()
    role_name = 'test_role'
    path = '/a/b/c'
    collection_name = 'test.units'
    entrypoint_filter = 'main'
    argspec = {
        'main': {
            'short_description': 'main short description'
        },
        'alternate': {
            'short_description': 'alternate short description'
        },
    }
    expected = {
        'path': path,
        'collection': collection_name,
        'entry_points': {
            'main': argspec['main'],
        }
    }
    fqcn, doc = obj._build_doc(role_name, path, collection_name, argspec,
                               entrypoint_filter)
    assert fqcn == '.'.join([collection_name, role_name])
    assert doc == expected
Пример #2
0
def test_rolemixin__build_summary_empty_argspec():
    obj = RoleMixin()
    role_name = 'test_role'
    collection_name = 'test.units'
    argspec = {}
    expected = {'collection': collection_name, 'entry_points': {}}

    fqcn, summary = obj._build_summary(role_name, collection_name, argspec)
    assert fqcn == '.'.join([collection_name, role_name])
    assert summary == expected
Пример #3
0
def test_rolemixin__build_doc_no_filter_match():
    obj = RoleMixin()
    role_name = 'test_role'
    path = '/a/b/c'
    collection_name = 'test.units'
    entrypoint_filter = 'doesNotExist'
    argspec = {
        'main': {
            'short_description': 'main short description'
        },
        'alternate': {
            'short_description': 'alternate short description'
        },
    }
    fqcn, doc = obj._build_doc(role_name, path, collection_name, argspec,
                               entrypoint_filter)
    assert fqcn == '.'.join([collection_name, role_name])
    assert doc is None
Пример #4
0
def test_rolemixin__build_summary():
    obj = RoleMixin()
    role_name = 'test_role'
    collection_name = 'test.units'
    argspec = {
        'main': {
            'short_description': 'main short description'
        },
        'alternate': {
            'short_description': 'alternate short description'
        },
    }
    expected = {
        'collection': collection_name,
        'entry_points': {
            'main': argspec['main']['short_description'],
            'alternate': argspec['alternate']['short_description'],
        }
    }

    fqcn, summary = obj._build_summary(role_name, collection_name, argspec)
    assert fqcn == '.'.join([collection_name, role_name])
    assert summary == expected