Exemplo n.º 1
0
    def testObjectInitialization(self):
        # Test normal case

        try:
            emailclient = smtpclient.smtpclient(conf['support-email'],
                                                conf['support-pw'])
        except Exception, e:
            print('test_smptclient / testObjectInitialization error: ', e)
Exemplo n.º 2
0
    def testConnectToMailserverWrongPW(self):
        # Test exception case

        try:
            emailclient = smtpclient.smtpclient(conf['support-email'], "bal")
            r = emailclient.connectToGMailServer(3)
        except smtplib.SMTPAuthenticationError, e:
            self.assertEqual(
                e[0], 535,
                "connection to GMAIL did not fail with pw error - see log messages"
            )
Exemplo n.º 3
0
    def testConnectToMailserverWrongUsername(self):
        # Test exception case

        try:
            emailclient = smtpclient.smtpclient('blabla', "bal")
            r = emailclient.connectToGMailServer(3)
        except smtplib.SMTPAuthenticationError, e:
            self.assertEqual(
                e[0], 535,
                "connection to GMAIL did not fail with username error - see log messages"
            )
Exemplo n.º 4
0
    def testSendEmailHappyFlow(self):
        # Test normal case

        try:
            emailclient = smtpclient.smtpclient(conf['support-email'],
                                                conf['support-pw'])
            r = emailclient.sendEmail([TESTEMAIL], "./content/testemail",
                                      conf['support-email'],
                                      "Unit-test" + datetime.now().isoformat())
            self.assertEqual(r, None, "send email not ok - see log messages")
        except Exception, e:
            print(e)
Exemplo n.º 5
0
    def testSendEmailWrongTo(self):
        # Test exception case

        emailclient = smtpclient.smtpclient(conf['support-email'],
                                            conf['support-pw'])
        err = emailclient.sendEmail([WRONGTESTEMAIL], "./content/testemail",
                                    conf['support-email'],
                                    "Unit-test" + datetime.now().isoformat())
        print(err)
        self.assertEqual(
            err[0][WRONGTESTEMAIL][0], 555,
            "connection to GMAIL did not fail with username error - see log messages"
        )
Exemplo n.º 6
0
    def testConnectToMailserverHappyFlow(self):
        # Test normal case

        try:
            emailclient = smtpclient.smtpclient(conf['support-email'],
                                                conf['support-pw'])
            r = emailclient.connectToGMailServer(3)
            self.assertEqual(
                r, None,
                "connection to GMAIL succeed - see log messages for 250 OK message"
            )
        except Exception, e:
            print('test_smptclient / testConnectToMailserver error: ', e)