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
Next Next commit
refactor: rename sync_repos into repo_synchronizer
  • Loading branch information
fbessou committed Jul 24, 2024
commit 55d6ae0f290463943e19ec77fec38301fe093cc9
2 changes: 1 addition & 1 deletion git_hg_sync/__main__.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

from git_hg_sync import config
from git_hg_sync.pulse_consumer import Worker
from git_hg_sync.sync_repos import RepoSynchronyzer
from git_hg_sync.repo_synchronizer import RepoSynchronyzer

HERE = Path(__file__).parent

File renamed without changes.
14 changes: 7 additions & 7 deletions tests/test_sync_repo.py → tests/test_repo_synchronizer.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import mozlog
import pytest

from git_hg_sync import __main__, sync_repos
from git_hg_sync import __main__, repo_synchronizer

HERE = Path(__file__).parent

@@ -61,21 +61,21 @@ def setup_module():


def test_parse_entity():
syncrepos = sync_repos.RepoSynchronyzer(None)
syncrepos = repo_synchronizer.RepoSynchronyzer(None)
push_entity = syncrepos.parse_entity(raw_push_entity)
assert isinstance(push_entity, sync_repos.Push)
assert isinstance(push_entity, repo_synchronizer.Push)
tag_entity = syncrepos.parse_entity(raw_tag_entity)
assert isinstance(tag_entity, sync_repos.Tag)
assert isinstance(tag_entity, repo_synchronizer.Tag)


def test_sync_process_with_bad_type():
syncrepos = sync_repos.RepoSynchronyzer(None)
with pytest.raises(sync_repos.EntityTypeError):
syncrepos = repo_synchronizer.RepoSynchronyzer(None)
with pytest.raises(repo_synchronizer.EntityTypeError):
syncrepos.sync({"type": "badType"})


def test_sync_process_with_bad_repo(repos_config):
syncrepos = sync_repos.RepoSynchronyzer(repos_config=repos_config)
syncrepos = repo_synchronizer.RepoSynchronyzer(repos_config=repos_config)
with pytest.raises(AssertionError) as e:
syncrepos.sync(raw_push_entity)
assert str(e.value) == f"clone {repos_config['repo_url']['clone']} doesn't exists"