Beispiel #1
0
def test_generate_template_with_values(kw):
    """
    Given keyword arguments, when calling generate_metadata() with them, then
    the generated template will use the povided values for each key.
    """
    k, v = kw
    ret = mod.generate_template(**{k: v})
    assert ret[k] == v
Beispiel #2
0
def test_generate_template_ignored_keywords():
    """
    Given a keyword that does not appear in specs, when calling
    generate_metadata() with a keyword argument that is named after that
    keyword, then the keyword does not get added to the template.
    """
    ret = mod.generate_template(foo='bar')
    assert 'foo' not in ret
Beispiel #3
0
def test_generate_template():
    """
    Given no arguments, when calling generate_metadata(), then it returns
    metadata with defaults for optional keys and blanks for required keys,
    except for broadcast which should be equal to '$BROADCAST'.
    """
    required = ['title', 'url', 'timestamp', 'broadcast', 'license']
    ret = mod.generate_template()
    for k in required:
        if k == 'broadcast':
            assert ret[k] == '$BROADCAST'
        else:
            assert ret[k] == ''
    for k in ret.keys():
        if k not in required:
            assert ret[k] == DEFAULTS[k]