Beispiel #1
0
    def test_conn_string_override(self):
        db, _ = set_up_database(
            "pgtest",
            "postgres",
            "pgtest_data",
            {"connection_string": "fake_connection_string"},
            "test/integration/config",
        )

        self.assertEqual(db._connection_string, "fake_connection_string")
Beispiel #2
0
    def test_conn_string_env(self):
        db, _ = set_up_database(
            "pgtest",
            "postgres",
            None,
            {"connection_string_env": "FAKE_CONNECTION_STRING_ENV"},
            "test/integration/config",
        )

        self.assertEqual(db._connection_string_env,
                         "FAKE_CONNECTION_STRING_ENV")
Beispiel #3
0
    def test_basic_config(self):
        db, dbconfig = set_up_database(
            "pgtest",
            "postgres",
            None,
            None,
            "test/integration/config",
        )

        self.assertEqual(db.database_alias, "pgtest")
        self.assertEqual(db.database_type, "postgres")
        self.assertEqual(db._connection_string, None)
        self.assertEqual(len(dbconfig["tables"]), 1)
Beispiel #4
0
    def test_data_override(self):
        db, _ = set_up_database(
            "pgtest",
            "postgres",
            "pgtest_data",
            {"data": {
                "foo": "bar",
                "bar": "nope"
            }},
            "test/integration/config",
        )

        self.assertEqual(db._db_template_data, {"foo": "bar", "bar": "nope"})
Beispiel #5
0
    def test_config_name(self):
        db, dbconfig = set_up_database(
            "pgtest",
            "postgres",
            "pgtest_data",
            None,
            "test/integration/config",
        )

        self.assertEqual(db.database_alias, "pgtest")
        self.assertEqual(db.database_type, "postgres")
        self.assertEqual(db._connection_string,
                         "postgresql://*****:*****@host:1234/test_db")
        self.assertEqual(len(dbconfig["tables"]), 1)
Beispiel #6
0
    def test_data(self):
        db, _ = set_up_database(
            "pgtest",
            "postgres",
            None,
            {"data": {
                "foo": "bar",
                "foobar": "hello"
            }},
            "test/integration/config",
        )

        self.assertEqual(db._db_template_data, {
            "foo": "bar",
            "foobar": "hello"
        })