def test_get_config0003(self, monkeypatch): """a config without a 'id' field crashes""" config = {u"gpg": u"gpg2"} monkeypatch.setattr(json, "loads", mk_dummy_json_load(config)) monkeypatch.setattr(passout, "_check_dirs", dummy_check_dirs) with pytest.raises(passout.PassOutError): config = passout.get_config()
def test_get_config0001(self, monkeypatch): """If we specify all config options, we get back a dict simply containing those options""" config = {u"clip_clear_time": 5, u"id": u"*****@*****.**", u"gpg": u"gpg2"} monkeypatch.setattr(json, "loads", mk_dummy_json_load(config)) monkeypatch.setattr(passout, "_check_dirs", dummy_check_dirs) config2 = passout.get_config() assert config == config2
def test_get_config0002(self, monkeypatch): """a config without a 'gpg' field gets a default one""" config = {u"id": u"*****@*****.**"} expect = {u"clip_clear_time": 5, u"id": u"*****@*****.**", u"gpg": u"gpg2"} monkeypatch.setattr(json, "loads", mk_dummy_json_load(config)) monkeypatch.setattr(passout, "_check_dirs", dummy_check_dirs) config = passout.get_config() assert config == expect
def test_get_config0002(self, monkeypatch): """a config with only the mandatory id field gives default values for the other fields""" config = {u"id": u"*****@*****.**"} expect = {u"clip_clear_time": 5, u"id": u"*****@*****.**", u"gpg": u"gpg2", "notify_cmd": ""} monkeypatch.setattr(json, "loads", mk_dummy_json_load(config)) monkeypatch.setattr(passout, "_check_dirs", dummy_check_dirs) config = passout.get_config() assert config == expect
def cfg(self): return passout.get_config()