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", )
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", )
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, )
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, )
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 ] == []
def test_send_emails_multiprocessing_invalid_outputfile_access(): with pytest.raises(PermissionError): emailee.AsyncMP(emailsWorking, serverWorking, outputFile="/root/noFileAccess.txt")
def test_send_emails_multiprocessing_invalid_outputfile_type(bad_data): with pytest.raises(PermissionError): emailee.AsyncMP(emailsWorking, serverWorking, outputFile=bad_data)