-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
eb71ad9
commit 3ce5b18
Showing
3 changed files
with
23 additions
and
1 deletion.
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
Empty file.
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,22 @@ | ||
import pytest | ||
from unittest.mock import patch, MagicMock | ||
|
||
from dbt.task.docs.serve import ServeTask | ||
from http.server import SimpleHTTPRequestHandler | ||
|
||
|
||
@pytest.fixture | ||
def serve_task(): | ||
# Set up | ||
task = ServeTask(config=MagicMock(), args=MagicMock()) | ||
task.config.project_target_path = "." | ||
task.args.port = 8000 | ||
return task | ||
|
||
|
||
def test_serve_bind_to_127(serve_task): | ||
serve_task.args.browser = False | ||
with patch("dbt.task.docs.serve.socketserver.TCPServer") as patched_TCPServer: | ||
patched_TCPServer.return_value = MagicMock() | ||
serve_task.run() | ||
patched_TCPServer.assert_called_once_with(("127.0.0.1", 8000), SimpleHTTPRequestHandler) |