Example #1
0
def test_template_sub_base_64_encoder():
    inp_str = ["Hello", "some:asdsad"]
    for s in inp_str:
        inp = '${utils("base64Encode", "' + s + '")}'
        output = template_sub(inp, {})
        assert output == str_to_base64e(s)
Example #2
0
def test_template_sub_uuid_generator():
    templated_str = "${uuid()}"
    output = template_sub(templated_str, {})
    assert UUID(output, version=4)
Example #3
0
def test_template_sub_random_string_generator():
    inp = "${random(10, True, True)}"
    output = template_sub(inp, {})
    assert len(output) == 10
    assert isinstance(output, str)
Example #4
0
def test_template_sub_variable():
    templated_str = "Hello ${name}"
    tokens = dict(name="John Doe")
    output = template_sub(templated_str, tokens)
    assert output == "Hello John Doe"