jfaustin's picture
add dockerfile and folding studio cli
44459bb
"""Test simple msa."""
from pathlib import Path
from unittest import mock
import pytest
from folding_studio.api_call.msa import simple_msa
from folding_studio.config import API_URL, REQUEST_TIMEOUT
from folding_studio.utils.data_model import MSARequestParams
@pytest.fixture(autouse=True)
def mock_post():
post_mock = mock.Mock()
mock_response = mock.MagicMock()
mock_response.ok = True
post_mock.return_value = mock_response
with mock.patch("requests.post", post_mock):
yield post_mock
@pytest.fixture(autouse=True)
def mock_get_auth_headers():
with mock.patch(
"folding_studio.api_call.msa.get_auth_headers",
return_value={"Authorization": "Bearer identity_token"},
) as m:
yield m
def test_simple_msa_pass(
tmp_path: Path, mock_post: pytest.FixtureRequest, headers: dict[str, str]
):
"""Test simple msa pass."""
file = tmp_path / "fasta_file.fasta"
file.touch()
params = MSARequestParams(
ignore_cache=False,
msa_mode="search",
)
simple_msa(
file,
params,
project_code="FOLDING_DEV",
)
mock_post.assert_called_once_with(
API_URL + "searchMSA",
data=params.model_dump(mode="json"),
headers=headers,
files=mock.ANY,
timeout=REQUEST_TIMEOUT,
params={"project_code": "FOLDING_DEV"},
)