Exemplo n.º 1
0
def main():
    while True:
        try:
            email_client = GmailClient(Configuration.get_email_address(), Configuration.get_password())
            task = raw_input("What task? ")
            TaskMailer(task=task, email_client=email_client).send()
            print  "Task sent successfully!"
        except MissingTaskException:
            print "Seriously we need a task..."
        except EmailNotSetException:
            Configuration.set_email_address(raw_input("We need your GMail username.  What is it? "))
        except PasswordNotSetException:
            Configuration.set_password(raw_input("We need your GMail password.  Give it up! "))
        except BadUsernamePasswordException:
            Configuration.set_password(raw_input("Google said your password was garbage. Want to try a new one? "))
        except CorruptConfigFileException:
            sys.stderr.write("Your config is corrupt.  Why don't you fix it? ")
            return
Exemplo n.º 2
0
 def test_updating_config_does_not_override_other_entries(self):
     Configuration.set_password('existed')
     Configuration.set_email_address('some_attribute_value')
     self.assertEquals('some_attribute_value', Configuration.get_email_address())
     self.assertEquals('existed', Configuration.get_password())
     
Exemplo n.º 3
0
 def test_can_save_and_get_password(self):
     Configuration.set_password('secret')
     self.assertEquals('secret', Configuration.get_password())