-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
8 changed files
with
74 additions
and
35 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
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
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,2 @@ | ||
- remove pyarrow dependency | ||
- remove git from local_bb |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
dvc==2.45.1 | ||
pytest-cov==4.0.0 | ||
click>=8.1.3 | ||
GitPython==3.1.37 | ||
requests>=2.0.0,<3.0.0 | ||
cloup>=3.0.0,<4.0.0 |
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 |
---|---|---|
@@ -1,21 +1,39 @@ | ||
# test_cli.py | ||
import pytest | ||
from biobricks.cli import register_on_biobricks | ||
import unittest | ||
from unittest.mock import patch, MagicMock | ||
from pathlib import Path | ||
from biobricks import Brick, cli | ||
from biobricks.config import write_config, init_bblib | ||
import tempfile | ||
|
||
# Using requests_mock to mock API responses | ||
@pytest.fixture | ||
def mock_request(requests_mock): | ||
mock_url = 'https://biobricks.ai/api/register' | ||
mock_response = { | ||
'auth_numbers': '12345', | ||
'auth_url': 'https://biobricks.ai/auth' | ||
} | ||
requests_mock.post(mock_url, json=mock_response, status_code=200) | ||
return requests_mock # This return isn't necessary but can be useful if you want to add more specifics in the fixture. | ||
def configure(bblib, token, overwrite, interactive): | ||
|
||
if not interactive: | ||
config = { "BBLIB": f"{bblib}", "TOKEN": token } | ||
write_config(config) | ||
init_bblib() | ||
return | ||
|
||
def test_register_on_biobricks(mock_request): # This should be the fixture name. | ||
result = register_on_biobricks('[email protected]') | ||
class TestBrickResolve(unittest.TestCase): | ||
|
||
tempdir = tempfile.TemporaryDirectory() | ||
|
||
assert result['message'] == "Authentication needed." | ||
assert result['auth_numbers'] == '12345' | ||
assert result['auth_url'] == 'https://biobricks.ai/auth' | ||
def setUp(self): | ||
bblib = Path(f"{TestBrickResolve.tempdir.name}/biobricks") | ||
bblib.mkdir(exist_ok=True,parents=True) | ||
configure(f"{bblib}", "VQF6Q2U-NKktZ31ioVYa9w", None, None) | ||
|
||
def tearDown(self) -> None: | ||
return super().tearDown() | ||
|
||
# test basic install of the hello-brick | ||
@patch('biobricks.bblib') | ||
def test_install_hello_brick(): | ||
from biobricks.brick import Brick | ||
brick = Brick.Resolve("hello-brick") | ||
brick.install() | ||
assert brick.path().exists() | ||
assert (brick.path() / "hello.txt").exists() | ||
assert (brick.path() / "hello.txt").read_text() == "hello world\n" | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |