Ejemplo n.º 1
0
def test_json_data_overrides_environ_variables():
    test_var = "TEST_ENVIRONMENT_VARIABLE"
    test_value = "am I found"
    os.environ[test_var] = test_value
    context = Context(fs.path.join("tests", "fixtures"))
    data = context.get_data("simple.json")
    eq_(data[test_var], test_value)
Ejemplo n.º 2
0
def test_unknown_data_file():
    test_var = "TEST_ENVIRONMENT_VARIABLE"
    test_value = "am I found"
    os.environ[test_var] = test_value
    context = Context(fs.path.join("tests", "fixtures"))
    data = context.get_data("unknown.data")
    eq_(data[test_var], test_value)
Ejemplo n.º 3
0
 def __init__(self, template_fs, context_dirs, engine):
     context_dirs = expand_template_directory(context_dirs)
     self.context = Context(context_dirs)
     self.template_fs = template_fs
     self.engine = engine
     self.templated_count = 0
     self.file_count = 0
     self.buffered_writer = BufferedWriter()
     self.engine_action = getattr(
         engine,
         "ACTION_IN_PRESENT_CONTINUOUS_TENSE",
         constants.LABEL_MOBAN_ACTION_IN_PRESENT_CONTINUOUS_TENSE,
     )
     self.engine_actioned = getattr(
         engine,
         "ACTION_IN_PAST_TENSE",
         constants.LABEL_MOBAN_ACTION_IN_PAST_TENSE,
     )
Ejemplo n.º 4
0
def test_context():
    context = Context(fs.path.join("tests", "fixtures"))
    data = context.get_data("simple.yaml")
    eq_(data["simple"], "yaml")
Ejemplo n.º 5
0
def test_non_existent_ctx_directries():
    Context(["abc"])