These tests ensure that our email import system works correctly. The main goals are to:
Send emails with attachments.
Receive and move emails to specific folders.
Check if emails are read or unread.
Import emails into our system.
Clean up by deleting emails and imported documents afterward.
Setup:
Get Environment Settings: Load the email server details and credentials from environment variables.
Encrypt Email Password: Securely encrypt the email password.
Send and Manage Emails:
Send Emails: Use an SMTP function to send emails with specific subjects and attachments.
Move Emails: Use IMAP functions to move emails to the target folder.
List Folders: Check if the target folder exists.
Delete Emails: Clean up emails by deleting them from folders.
Check Email Status: Verify if emails are marked as unread or read.
Test Sequence
Initial Setup:
Check Connection: Verify connection to the email server and get the connection ID.
Login Test: Confirm that logging in with stored credentials works.
Folder Check: Ensure the target folder exists on the email server.
Email Operations:
Send Test Emails: Send three emails with unique subjects.
Retrieve Email IDs: Get the IDs of the sent emails from the inbox.
Move Emails: Move these emails from the inbox to the target folder.
Check Email Status: Ensure the emails in the target folder are marked as unread.
Email Importing:
Fetch Emails: Import emails from the target folder into our system.
Check Imported Emails: Ensure the imported emails are correctly fetched and logged.
Log Verification:
Check Import Logs: Verify that the subjects of the sent emails are recorded in the import logs.
Cleanup:
Delete Imported Documents: Remove the documents that were imported from the emails.
Delete Emails: Clean up by deleting the sent and moved emails from the folders.
Setup and Initialization:
Initialize Shared Data: Prepare shared data for tests.
Email Connection Tests:
Get Connection ID: Check if we can connect to the email server and get an ID for the connection.
Login Verification: Ensure that logging in to the email server works properly.
Folder Verification Tests:
Check Target Folder: Make sure the target folder exists on the email server.
Verify Folder Listing: Ensure the list of folders from the server matches our expectations.
Email Sending and ID Retrieval:
Send Emails: Send three test emails with specific subjects and attachments.
Get Email IDs: Retrieve the unique IDs of these sent emails from the inbox.
Email Moving and Status Checking:
Move Emails to Folder: Move the test emails from the inbox to the target folder.
Check Unread Status: Ensure the emails are marked as unread after moving.
Email Fetching and Response Validation:
Fetch Emails from Folder: Import the emails from the target folder into our system.
Validate Fetched Emails: Confirm that the fetched emails match the sent emails.
Import Log Verification:
Fetch Import Log: Retrieve the log of imported emails.
Check Email Subjects in Log: Ensure the subjects of the test emails are present in the import log.
Cleanup:
Delete Imported Documents: Remove the documents that were imported from the emails.
Delete Emails: Delete the test emails from the inbox and the target folder to keep everything clean.
\
These tests ensure that our system can handle email importing correctly. This includes sending emails, receiving and moving them to specific folders, checking if they are read or unread, importing them into the system, and performing cleanup afterward.
Setup:
Get Environment Settings: Load necessary details like email server information and credentials from environment variables.
Encrypt Email Password: Securely encrypt the email password for safe usage.
Email Sending and Management:
Send an Email: Use an SMTP function to send an email with a specific subject and attachment.
Move the Email: Use IMAP functions to move the email to a target folder.
List Folders: Ensure the target folder exists.
Delete the Email: Clean up by deleting the email from the folder.
Check Email Status: Verify if the email is marked as read or unread.
Test Sequence
Initial Setup:
Check Connection: Verify connection to the email server and get the connection ID.
Login Test: Confirm that logging in with stored credentials works.
Folder Check: Ensure the target folder exists on the email server.
Email Operations:
Send a Test Email: Send an email with a specific subject.
Retrieve Email ID: Get the ID of the sent email from the inbox.
Move the Email: Move the email from the inbox to the target folder.
Check Email Status: Ensure the email in the target folder is marked as unread.
Email Importing:
Fetch the Email: Import the email from the target folder into our system.
Check Imported Email: Ensure the imported email is correctly fetched and logged.
Log Verification:
Check Import Log: Verify that the subject of the sent email is recorded in the import log.
Cleanup:
Delete Imported Document: Remove the document that was imported from the email.
Delete the Email: Delete the sent and moved email from the folders to keep everything clean.
Setup and Initialization:
Initialize Shared Data: Prepare shared data for tests.
Email Connection Tests:
Get Connection ID: Check if we can connect to the email server and get an ID for the connection.
Login Verification: Ensure that logging in to the email server works properly.
Folder Verification Tests:
Check Target Folder: Make sure the target folder exists on the email server.
Verify Folder Listing: Ensure the list of folders from the server matches our expectations.
Email Sending and ID Retrieval:
Send an Email: Send a test email with a specific subject and attachment.
Get Email ID: Retrieve the unique ID of this sent email from the inbox.
Email Moving and Status Checking:
Move Email to Folder: Move the test email from the inbox to the target folder.
Check Unread Status: Ensure the email is marked as unread after moving.
Email Fetching and Response Validation:
Fetch Email from Folder: Import the email from the target folder into our system.
Validate Fetched Email: Confirm that the fetched email is present in the response.
Import Log Verification:
Fetch Import Log: Retrieve the log of imported emails.
Check Email Subject in Log: Ensure the subject of the test email is present in the import log.
Cleanup:
Delete Imported Document: Remove the document that was imported from the email.
Delete the Email: Delete the test email from the inbox and the target folder to keep everything clean.
\
De "Importeren" instellingen in uw documentverwerkingssysteem stellen u in staat om te configureren hoe documenten uit verschillende bronnen in het systeem worden geïmporteerd, inclusief instellingen voor zowel FTP (File Transfer Protocol) als e-mail. Hier is een overzicht van deze instellingen:
Documentinstellingen:
Beperk tot pagina's: Hiermee kunt u de verwerking beperken tot een bepaald aantal pagina's van elk document.
Betalingsvoorwaarden Dagen: Definieert de standaard betalingsvoorwaarden (in dagen) die op documenten kunnen worden toegepast.
Datumpatroon: Stelt het patroon in voor hoe data herkend en geformatteerd moeten worden binnen geïmporteerde documenten.
FTP Import:
Type: Definieert het type FTP-protocol dat gebruikt moet worden (bijv. SFTP).
Server URL: Het serveradres waar documenten van worden opgehaald.
Gebruikersnaam en Poort: Inloggegevens en poortnummer voor toegang tot de FTP-server.
Standaardmap: Geeft de map op de FTP-server aan waar bestanden zullen worden geïmporteerd.
De extra optie om nieuwe gegevens toe te voegen omvat velden zoals:
Wachtwoord: Voor authenticatie.
Bestandsnaam overeenkomende patronen: Om aan te geven welke bestanden moeten worden geïmporteerd op basis van hun namen.
Sub-organisaties: Selecteer op welke sub-organisatie de importinstellingen van toepassing moeten zijn.
E-mail Import:
E-mailadres: Stel een e-mailaccount in waar documenten naartoe kunnen worden gestuurd voor import.
Gebruikersnaam en Wachtwoord: Inloggegevens voor toegang tot het e-mailaccount.
Protocol en Versleuteling: Geef het protocol (IMAP, POP3) en het type versleuteling op.
Samensmelten van bijgevoegde documenten: Optie om alle bijgevoegde documenten samen te voegen tot één document bij import.
Dit stelt ook in staat om sub-organisaties op te geven voor meer nauwkeurige controle over waar e-mails binnen uw organisatiestructuur naartoe worden gestuurd.
These tests are designed to ensure that our file import system works correctly. We specifically test the import of PDF and TIFF files into the system, ensuring that they are processed and stored successfully.
Setup:
Before each test, we log a setup message.
Cleanup: After each test, we clean up by deleting any documents created by the test user from the database to ensure no leftover data affects subsequent tests.
Import PDF File:
Test Import PDF (test_import_pdf
):
Import a PDF file (FellowBananaInvoice.pdf
) into the system.
Expected Outcome: The file should be imported successfully, returning a document ID.
Import TIFF File:
Test Import TIFF (test_import_tiff
):
Import a TIFF file (TIFF_FILE.TIF
) into the system.
Expected Outcome: The file should be imported successfully, returning a document ID.
Setup and Cleanup:
Logging: A setup and cleanup message is logged for each test.
Database Cleanup (clean_documents
): Deletes any documents created by the test user from the database to maintain a clean state.
File Import Tests:
Import PDF File:
Load User: Load the test user.
File Path: Specify the path to the PDF file (tests/files/pdfs/FellowBananaInvoice.pdf
).
Import File: Use the FileImporter
class to import the PDF file.
Check Response: Ensure the response is a list containing a success message and a document ID.
Import TIFF File:
Load User: Load the test user.
File Path: Specify the path to the TIFF file (tests/files/pdfs/TIFF_FILE.TIF
).
Import File: Use the FileImporter
class to import the TIFF file.
Check Response: Ensure the response is a list containing a success message and a document ID.
Logger: Used to log debug messages during setup, cleanup, and test execution.
Database Helper: Executes queries without returning results for cleanup.
File Importer: Handles the import of files into the system.
Fixtures: set_up
fixture to manage setup and cleanup for tests.
Tests:
test_import_pdf
: Tests importing a PDF file.
test_import_tiff
: Tests importing a TIFF file.
These tests ensure that our file import functionality works as expected for both PDF and TIFF files. By following this approach, we verify that files are imported correctly and that the system can handle different file types without issues.
These tests ensure that our FTP import system works correctly. We verify that we can add a new FTP import connection, test the connection, activate/deactivate it, and clean it up afterward.
Setup:
Environment Variables: Load necessary details like FTP server information and credentials from environment variables.
FTP Connection Tests:
Add New Connection:
Test Add New FTP Import Connection (test_add_new_ftp_import_connection
):
Add a new FTP import connection with the given credentials and server details.
Expected Outcome: The connection should be added successfully.
Deactivate Connection:
Test Deactivate FTP Import Connection (test_deactivate_ftp_import_connection
):
Deactivate the newly added FTP import connection.
Expected Outcome: The connection should be deactivated successfully.
Test Connection:
Test FTP Connection (test_test_ftp_connection
):
Test if the FTP import connection can successfully connect to the FTP server.
Expected Outcome: The connection should be tested successfully.
Check Connection in List:
Test Check FTP Connection in List (test_check_ftp_connection_in_list
):
Check if the newly added FTP import connection is present in the list of connections.
Expected Outcome: The connection should be found in the list.
Check Connection Deactivated:
Test Check FTP Connection Deactivated (test_check_ftp_connection_deactivated
):
Verify that the FTP import connection is marked as inactive in the list.
Expected Outcome: The connection should be inactive.
Add Test Folder:
Test Add Test Folder to Connection (test_add_test_folder_to_connection
):
Add a default directory (test folder) to the FTP import connection.
Expected Outcome: The default directory should be added successfully.
Reactivate Connection:
Test Reactivate FTP Import Connection (test_reactivate_ftp_import_connection
):
Reactivate the previously deactivated FTP import connection.
Expected Outcome: The connection should be reactivated successfully.
Check Connection Reactivated:
Test Check FTP Connection Reactivated (test_check_ftp_connection_reactivated
):
Verify that the FTP import connection is marked as active in the list.
Expected Outcome: The connection should be active.
Cleanup:
Test Cleanup FTP Import (test_cleanup_ftp_import
):
Delete the FTP import connection to clean up after the tests.
Expected Outcome: The connection should be deleted successfully.
Setup and Initialization:
Initialize Shared Data: Prepare shared data for tests.
FTP Connection Tests:
Add New Connection: Add a new FTP import connection with the provided credentials and server details.
Deactivate Connection: Deactivate the newly added FTP import connection.
Test Connection: Test if the FTP import connection can successfully connect to the FTP server.
Check Connection in List: Verify that the new FTP import connection is present in the list of connections.
Check Connection Deactivated: Confirm that the FTP import connection is marked as inactive in the list.
Add Test Folder: Add a default directory (test folder) to the FTP import connection.
Reactivate Connection: Reactivate the previously deactivated FTP import connection.
Check Connection Reactivated: Ensure that the FTP import connection is marked as active in the list.
Cleanup: Delete the FTP import connection to clean up after the tests.
\