def main_arguments(adapter: MssqlLmsOperations, csv_path: str) -> MainArguments: args = MainArguments(csv_path=csv_path, engine="mssql", log_level="INFO") args.set_connection_string_using_integrated_security( "localhost", 1433, "test_integration_lms_toolkit") # monkey patch the test adapter args.get_db_operations_adapter = lambda: adapter # type: ignore return args
def it_should_use_default_value_of_1433() -> None: server = "my-server" database = "my-database" port = None expected = "mssql+pyodbc://my-server,1433/my-database?driver=ODBC+Driver+17+for+SQL+Server?Trusted_Connection=yes" a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0]) a.set_connection_string_using_integrated_security( server, port, database, ) assert a.connection_string == expected
def it_should_return_a_pyodbc_connection_string_with_trusted_connection( ) -> None: server = "my-server" database = "my-database" port = 1234 expect = "mssql+pyodbc://my-server,1234/my-database?driver=ODBC+Driver+17+for+SQL+Server?Trusted_Connection=yes" a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0]) a.set_connection_string_using_integrated_security( server, port, database, ) assert a.connection_string == expect