Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separation of concerns #2

Merged
merged 6 commits into from
Jul 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
style: run black
  • Loading branch information
fbessou committed Jul 24, 2024
commit 6774a1e3306e3a398461e0c37f0e7e46244ee4e8
4 changes: 1 addition & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import pytest
import mozlog


@pytest.fixture(autouse=True)
def mozlog_logging():
logger = mozlog.structuredlog.StructuredLogger("tests")
mozlog.structuredlog.set_default_logger(logger)



4 changes: 3 additions & 1 deletion tests/test_pulse_worker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest

from git_hg_sync.pulse_worker import PulseWorker, EntityTypeError
from git_hg_sync.repo_synchronizer import Push, Tag
from git_hg_sync.repo_synchronizer import Push, Tag


def raw_push_entity():
return {
@@ -28,6 +29,7 @@ def raw_tag_entity():
"push_json_url": "push_json_url",
}


def test_parse_entity_valid():
push_entity = PulseWorker.parse_entity(raw_push_entity())
assert isinstance(push_entity, Push)
13 changes: 12 additions & 1 deletion tests/test_repo_synchronizer.py
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
from git_hg_sync.__main__ import get_connection, get_queue
from git_hg_sync.repo_synchronizer import RepoSynchronyzer, Push


@pytest.fixture
def pulse_config():
return {
@@ -32,7 +33,17 @@ def repos_config():
def test_sync_process_with_bad_repo(repos_config):
syncrepos = RepoSynchronyzer(repos_config=repos_config)
with pytest.raises(AssertionError) as e:
syncrepos.sync(Push(repo_url="repo_url", heads=["head"], commits=["commits"], time=0, pushid=0, user="user", push_json_url="push_json_url"))
syncrepos.sync(
Push(
repo_url="repo_url",
heads=["head"],
commits=["commits"],
time=0,
pushid=0,
user="user",
push_json_url="push_json_url",
)
)
assert str(e.value) == f"clone {repos_config['repo_url']['clone']} doesn't exists"


Loading
Oops, something went wrong.