示例#1
0
    def test_datetime_exec(self, monkeypatch, pytask_io_fixture):

        p = Task(
            pytask_io_fixture,
            password="******",
            sender_email="*****@*****.**",
            host="smtp.gmail.com",

        )

        r = p.send_email(
            subject="test subject 1",
            body="test body 1",
            receiver_email="*****@*****.**",
        )

        timestamp = p.datetime_exec()

        assert isinstance(timestamp, datetime.datetime)
示例#2
0
    def test_get_email_response(self, monkeypatch, pytask_io_fixture):

        p = Task(
            pytask_io_fixture,
            password="******",
            sender_email="*****@*****.**",
            host="smtp.gmail.com",

        )

        r = p.send_email(
            subject="test subject 1",
            body="test body 1",
            receiver_email="*****@*****.**",
        )

        r = p.get_email_response(r)

        assert "metadata" in r
示例#3
0
    def test_exec_time(self, monkeypatch, pytask_io_fixture):

        p = Task(
            pytask_io_fixture,
            password="******",
            receiver_email=
            "*****@*****.**",  # Or a list of emails receiver_email=["*****@*****.**", ...],
            sender_email="*****@*****.**",
            host="smtp.gmail.com",
        )

        r = p.send_email(
            subject="test subject 1",
            body="test body 1",
        )

        r = p.get_email_response(r)

        timestamp = p.exec_time(r)

        assert isinstance(timestamp, datetime.datetime)
示例#4
0
    def test_send_email(self, monkeypatch, pytask_io_fixture):

        p = Task(
            pytask_io_fixture,
            password="******",
            sender_email="*****@*****.**",
            host="smtp.gmail.com",

        )

        subject = "test subject 1"
        body = "test body 1"

        r = p.send_email(
            subject="test subject 1",
            body="test body 1",
            receiver_email="*****@*****.**",  # Or a list of emails receiver_email=["*****@*****.**", ...],
        )

        assert r["email"]["subject"] == subject
        assert r["email"]["body"] == body
        assert isinstance(r["email"]["email_init"], datetime.datetime)
        assert r["metadata"] == payload_one