コード例 #1
0
        def it_should_create_the_requested_adapter() -> None:
            a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0])
            a.set_connection_string("server", None, "database", "username",
                                    "password")
            actual = a.get_db_operations_adapter()

            assert type(actual) is MssqlLmsOperations
コード例 #2
0
        def it_should_raise_NotImplementedError() -> None:
            with pytest.raises(NotImplementedError):
                a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0])
                a.set_connection_string("server", None, "database", "username",
                                        "password")

                a.engine = "PostgreSQL"
                a.get_db_operations_adapter()
コード例 #3
0
                def it_should_use_default_value_of_1433() -> None:
                    expected = "mssql+pyodbc://me:yo@my-server,1433/my-database?driver=ODBC+Driver+17+for+SQL+Server"

                    server = "my-server"
                    database = "my-database"
                    port = None
                    username = "******"
                    password = "******"

                    a = MainArguments("some/path", DbEngine.MSSQL,
                                      LOG_LEVELS[0])
                    a.set_connection_string(server, port, database, username,
                                            password)

                    assert a.connection_string == expected
コード例 #4
0
                def it_should_return_a_pyodbc_connection_string_with_trusted_connection(
                ) -> None:
                    server = "my-server"
                    database = "my-database"
                    port = 1234
                    username = "******"
                    password = "******"
                    expected = "mssql+pyodbc://me:yo@my-server,1234/my-database?driver=ODBC+Driver+17+for+SQL+Server"

                    a = MainArguments("some/path", DbEngine.MSSQL,
                                      LOG_LEVELS[0])
                    a.set_connection_string(server, port, database, username,
                                            password)

                    assert a.connection_string == expected