Skip to content

Commit

Permalink
test: 96%
Browse files Browse the repository at this point in the history
  • Loading branch information
datnguye committed Jan 6, 2024
1 parent 3752c06 commit ff74344
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dbterd/helpers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,11 @@ def read_catalog(path: str, version: int = None):


def write_json(data, path: str):
"""Persist json data to file
Args:
data (json): Json data
path (str): File path
"""
with open(path, "w") as file:
file.write(data)
14 changes: 14 additions & 0 deletions tests/unit/adapters/test_dbt_cloud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# from unittest import mock

# import click
# import pytest

# from dbterd.adapters.dbt_cloud import DbtCloudArtifact


class TestDbtCloudArtifact:
def test_download_artifact(self):
pass

def test_get(self):
pass
5 changes: 5 additions & 0 deletions tests/unit/helpers/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@ def test_read_catalog_error(self, mock_open_json, version):
with pytest.raises(ValueError):
file.read_catalog(path="path/to/catalog", version=version)
mock_open_json.assert_called_with("path/to/catalog/catalog.json")

@mock.patch("builtins.open")
def test_write_json(self, mock_open):
file.write_json(data={}, path="path/to/catalog/catalog.json")
mock_open.assert_called_with("path/to/catalog/catalog.json", "w")

0 comments on commit ff74344

Please sign in to comment.