def test_other_db_errors_are_raised_directly( self, db_session, user, programming_error ): action = GroupUpsertAction(db_session) with patch.object(action, "_execute_statement") as _execute_statement: _execute_statement.side_effect = programming_error with pytest.raises(ProgrammingError): action.execute([group_upsert_command(0)], effective_user_id=user.id)
def test_it_returns_in_the_same_order_as_the_commands( self, db_session, commands, user): # Insert the values to set db order, then update them in reverse action = GroupUpsertAction(db_session) reports = action.execute(commands, effective_user_id=user.id) reversed_reports = action.execute(list(reversed(deepcopy(commands))), effective_user_id=user.id) ids = [report.id for report in reports] reversed_ids = [report.id for report in reversed_reports] assert reversed_ids == list(reversed(ids))