feat: add git push subcommand
This commit is contained in:
parent
c859c60c8d
commit
8076807f22
8 changed files with 92 additions and 30 deletions
37
tests/commands/test_git/test_push.py
Normal file
37
tests/commands/test_git/test_push.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
from halig.commands.git.commit import GitCommitCommand
|
||||
from halig.commands.git.push import GitPushCommand
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def command(settings, faker):
|
||||
"""Configure a local remote for testing"""
|
||||
commit_command = GitCommitCommand(settings)
|
||||
new_path = shutil.copytree(settings.notebooks_root_path , settings.notebooks_root_path / "../remote")
|
||||
new_path = new_path.resolve()
|
||||
for _ in range(10):
|
||||
random_age_file = settings.notebooks_root_path / f"{faker.word()}.age"
|
||||
random_age_file.touch()
|
||||
commit_command.run()
|
||||
|
||||
push_command = GitPushCommand(settings)
|
||||
|
||||
push_command.repo.create_remote("origin", str(new_path))
|
||||
|
||||
return push_command
|
||||
|
||||
|
||||
def test_push_to_origin(settings, command):
|
||||
"""Test that the command pushes to the origin remote"""
|
||||
command.run()
|
||||
|
||||
def test_push_to_custom_remote(settings, command):
|
||||
"""Test that the command pushes to a custom remote"""
|
||||
|
||||
remote_path = settings.notebooks_root_path / "../remote"
|
||||
command.repo.create_remote("custom", str(remote_path.resolve()))
|
||||
|
||||
command.run(remotes=["custom"])
|
||||
Loading…
Add table
Add a link
Reference in a new issue