def it_should_match_the_record(test_pgsql_db: Tuple[SqlLmsOperations, Connection, ConnectionSettings]): adapter, connection, settings = test_pgsql_db section_identifier_1 = 13 insert_section(connection, "B098765", SOURCE_SYSTEM, section_identifier_1) section_identifier_2 = 14 insert_section(connection, "B109876", SOURCE_SYSTEM, section_identifier_2) insert_assignment(connection, "B123456", SOURCE_SYSTEM, 11, section_identifier_1) insert_assignment(connection, "B234567", SOURCE_SYSTEM, 12, section_identifier_2) # act run_loader(main_arguments(adapter, CSV_PATH, settings)) # assert - records are unchanged Assignment = connection.execute( "select sourcesystem, sourcesystemidentifier, deletedat from lms.assignment order by sourcesystemidentifier" ).fetchall() assert len(Assignment) == 2 assert [SOURCE_SYSTEM, SOURCE_SYSTEM] == [x["sourcesystem"] for x in Assignment] assert ["B123456", "B234567" ] == [x["sourcesystemidentifier"] for x in Assignment] assert [None, None] == [x["deletedat"] for x in Assignment]
def it_should_soft_delete_the_record( test_pgsql_db: Tuple[SqlLmsOperations, Connection, ConnectionSettings]): adapter, connection, settings = test_pgsql_db # arrange - note csv file has only B123456 user_identifier = 13 insert_user(connection, "U123456", SOURCE_SYSTEM, user_identifier) section_identifier = 14 insert_section(connection, "S098765", SOURCE_SYSTEM, section_identifier) assignment_identifier = 15 insert_assignment(connection, "B098765", SOURCE_SYSTEM, assignment_identifier, section_identifier) insert_record(connection, "B123456", SOURCE_SYSTEM, assignment_identifier, user_identifier) insert_record(connection, "B234567", SOURCE_SYSTEM, assignment_identifier, user_identifier) # act run_loader(main_arguments(adapter, CSV_PATH, settings)) # assert - B234567 has been soft deleted AssignmentSubmission = connection.execute( "select sourcesystemidentifier from lms.assignmentsubmission where deletedat is not null" ).fetchall() assert len(AssignmentSubmission) == 1 assert AssignmentSubmission[0]["sourcesystemidentifier"] == "B234567"
def it_should_match_the_record(test_pgsql_db: Tuple[SqlLmsOperations, Connection, ConnectionSettings]): adapter, connection, settings = test_pgsql_db user_identifier = 11 insert_user(connection, "U123456", SOURCE_SYSTEM, user_identifier) user_identifier = 12 insert_user(connection, "U123456", "FirstLMS", user_identifier) section_identifier = 13 insert_section(connection, "S098765", SOURCE_SYSTEM, section_identifier) section_identifier = 14 insert_section(connection, "S098765", "FirstLMS", section_identifier) assignment_identifier_1 = 15 insert_assignment(connection, "B098765", SOURCE_SYSTEM, assignment_identifier_1, section_identifier) assignment_identifier_2 = 16 insert_assignment(connection, "F098765", SOURCE_SYSTEM, assignment_identifier_2, section_identifier) insert_record(connection, "B123456", SOURCE_SYSTEM, assignment_identifier_1, user_identifier) insert_record(connection, "F234567", "FirstLMS", assignment_identifier_2, user_identifier) # act run_loader(main_arguments(adapter, CSV_PATH, settings)) # assert - records are unchanged AssignmentSubmission = connection.execute( "select sourcesystem, sourcesystemidentifier, deletedat from lms.assignmentsubmission order by sourcesystemidentifier" ).fetchall() assert len(AssignmentSubmission) == 2 assert [SOURCE_SYSTEM, "FirstLMS" ] == [x["sourcesystem"] for x in AssignmentSubmission] assert ["B123456", "F234567"] == [ x["sourcesystemidentifier"] for x in AssignmentSubmission ] assert [None, None] == [x["deletedat"] for x in AssignmentSubmission]