-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49d522a
commit 377817b
Showing
2 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Licensed under a BSD-style 3-clause license - see LICENSE.md. | ||
# -*- coding: utf-8 -*- | ||
"""Test dlairflow.postgresql. | ||
""" | ||
import os | ||
from ..postgresql import pg_dump_schema, pg_restore_schema | ||
from airflow.hooks.base import BaseHook | ||
|
||
|
||
class MockConnection(object): | ||
|
||
def __init__(self, connection): | ||
foo = connection.split(',') | ||
self.login = foo[0] | ||
self.password = foo[1] | ||
self.host = foo[2] | ||
self.schema = foo[3] | ||
return | ||
|
||
|
||
def test_pg_dump_schema(monkeypatch): | ||
"""Test pg_dump task. | ||
""" | ||
def mock_connection(connection): | ||
conn = MockConnection(connection) | ||
return conn | ||
|
||
monkeypatch.setattr(BaseHook, "get_connection", mock_connection) | ||
|
||
test_operator = pg_dump_schema("login,password,host,schema") | ||
|
||
print(dir(test_operator)) |