예제 #1
0
def test_send_emails_threaded_broken_server():
    with pytest.raises(ValueError):
        emailee.AsyncThreads(
            emailsWorking,
            serverBroken,
            outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
            "/tests/test_output.txt",
        )
예제 #2
0
def test_send_emails_threaded_invalid_server_type(bad_data):
    with pytest.raises(TypeError):
        emailee.AsyncThreads(
            emailsWorking,
            bad_data,
            outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
            "/tests/test_output.txt",
        )
예제 #3
0
def test_send_emails_threaded_invalid_throttled_value(bad_data):
    with pytest.raises(ValueError):
        emailee.AsyncThreads(
            emailsWorking,
            serverWorking,
            outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
            "/tests/test_output.txt",
            maxThreads=bad_data,
        )
예제 #4
0
def test_send_emails_threaded_working_throttled(file_setup):
    helper_set_subject(emailsWorking, emailsWorkingExpectedOutput)
    email = emailee.AsyncThreads(
        emailsWorking,
        serverWorking,
        outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
        "/tests/test_output.txt",
        maxThreads=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
    ] == []
예제 #5
0
def test_send_emails_threaded_working_one_min_params_server(file_setup):
    helper_set_subject(emailsWorkingSingleBare,
                       emailsWorkingSingleBareExpectedOutput)
    email = emailee.AsyncThreads(
        emailsWorkingSingleBare,
        serverWorkingBare,
        outputFile=os.environ["EMAILEE_TEST_EMAILEE_PATH"] +
        "/tests/test_output.txt",
        waitTime=1,
    )
    emailReportSorted = sorted(email.emailReport, key=lambda i: i["subject"])
    emailExpectedSorted = sorted(emailsWorkingSingleBareExpectedOutput,
                                 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_threaded_invalid_outputfile_access():
    with pytest.raises(PermissionError):
        emailee.AsyncThreads(emailsWorking,
                             serverWorking,
                             outputFile="/root/noFileAccess.txt")
예제 #7
0
def test_send_emails_threaded_invalid_outputfile_type(bad_data):
    with pytest.raises(PermissionError):
        emailee.AsyncThreads(emailsWorking, serverWorking, outputFile=bad_data)