Ejemplo n.º 1
0
 def test_getitem_delegates_to_subconfigs(self):
     arg_config = {"number 5": "is alive"}
     env_config = {"number 5": "is DEEEAAAADD"}
     file_config = {"number 7": "I am"}
     config = MetaConfig(include_arg_config=True)
     config._argument_config = arg_config
     config._env_config = env_config
     config._file_config = file_config
     eq_(config["number 5"], "is alive")
     eq_(config["number 7"], "I am")
Ejemplo n.º 2
0
 def test_nonexistent_items_cause_an_error(self):
     config = MetaConfig([])
     config._argument_config = {}
     config._env_config = {}
     config._file_config = {}
     try:
         config["rausch"]
     except KeyError as e:
         eq_(
             e.message,
             "Couldn't find any setting at all for 'rausch'. "
             "You'll need to supply it in some way--try `catsnap "
             "config`, or see the docs for other ways to supply "
             "a setting.",
         )
     else:
         raise AssertionError("this test shoulda thrown")
Ejemplo n.º 3
0
    def test_getattr_delegates_to_getitem(self):
        config = MetaConfig()
        config._argument_config = {"aws_access_key_id": "itsme"}

        eq_(config.aws_access_key_id, "itsme")