def test_write_config(self): conf = { "url": "jellyms.kr", "smtpServer": "smtp.gmail.com:587", "smtpUser": "******", "toEmail": "*****@*****.**" } write_config(conf) self.assertEquals(conf, read_config())
def main(argv): if len(sys.argv) == 1: conf = set_config() s_pw = conf["smtpPw"] write_config(conf) else: """if exist argv, set password and execute with default configure""" s_pw = extract_password_with_argv(argv) conf = read_config() conf["smtpPw"] = s_pw smtp_login_with_conf_test(conf) checker(conf)
def test_input_conf(self): conf = { "url": "jellyms.kr", "smtpServer": "smtp.gmail.com:587", "smtpUser": "******", "toEmail": "*****@*****.**" } write_config(conf) with mock.patch("__builtin__.raw_input", return_value=""): self.assertEquals(conf["url"], input_conf( "Please just enter", conf["url"])) with mock.patch("__builtin__.raw_input", return_value="test"): self.assertEquals("test", input_conf( "Please write 'test'", conf["url"]))