예제 #1
0
def test_send_emails_multiprocessing_broken_server():
    with pytest.raises(ValueError):
        emailee.AsyncMP(
            emailsWorking,
            serverBroken,
            outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
            "/tests/test_output.txt",
        )
예제 #2
0
def test_send_emails_multiprocessing_invalid_server_type(bad_data):
    with pytest.raises(TypeError):
        emailee.AsyncMP(
            emailsWorking,
            bad_data,
            outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
            "/tests/test_output.txt",
        )
예제 #3
0
def test_send_emails_multiprocessing_large(file_setup):
    helper_set_subject(emailsWorkingLong)
    emailee.AsyncMP(
        emailsWorkingLong,
        serverWorking,
        outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
        "/tests/test_output.txt",
        waitTime=1,
    )
예제 #4
0
def test_send_emails_multiprocessing_invalid_wait_time_value(bad_data):
    with pytest.raises(ValueError):
        emailee.AsyncMP(
            emailsWorking,
            serverWorking,
            outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
            "/tests/test_output.txt",
            waitTime=bad_data,
        )
예제 #5
0
def test_send_emails_multiprocessing_working(file_setup):
    helper_set_subject(emailsWorking, emailsWorkingExpectedOutput)
    email = emailee.AsyncMP(
        emailsWorking,
        serverWorking,
        outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
        "/tests/test_output.txt",
        waitTime=1,
    )
    emailReportSorted = sorted(email.emailReport, key=lambda i: i["subject"])
    emailExpectedSorted = sorted(emailsWorkingExpectedOutput,
                                 key=lambda i: i["subject"])
    assert [
        i for i in emailReportSorted + emailExpectedSorted
        if i not in emailReportSorted or i not in emailExpectedSorted
    ] == []
예제 #6
0
def test_send_emails_multiprocessing_invalid_outputfile_access():
    with pytest.raises(PermissionError):
        emailee.AsyncMP(emailsWorking,
                        serverWorking,
                        outputFile="/root/noFileAccess.txt")
예제 #7
0
def test_send_emails_multiprocessing_invalid_outputfile_type(bad_data):
    with pytest.raises(PermissionError):
        emailee.AsyncMP(emailsWorking, serverWorking, outputFile=bad_data)