"""main cli integration tests.""" import pytest from tests.integration.utils import run_command @pytest.mark.xfail(reason="Execute `sync all` outside of pytest.") def test_sync_all() -> None: """Test sync all command works.""" run_command( ["m2mconfig", "sync", "all", "qa"], expected_returncode=0, ) @pytest.mark.parametrize( "additional_args, description", [ ([], "Environment argument is required"), (["fake-env"], "environment must be one of qa or prod."), ], ) def test_sync_all_arguments( additional_args: list[str], description: str, ) -> None: """Test sync all command requires environment argument.""" command_args = ["m2mconfig", "sync", "all"] command_args.extend(additional_args) run_command( command_args, # noqa: E501 expected_returncode=2, description=description, ) def test_sync_one() -> None: """Test sync one command works.""" run_command( [ "poetry", "run", "m2mconfig", "sync", "one", "qa", "lambda-some-machine", ], expected_returncode=0, ) @pytest.mark.parametrize( "additional_args, description", [ ([], "environment and machine_name argument is required"), (["fake-env", "some-machine"], "environment must be one of qa or prod."), (["qa"], "machine_name is required."), ], ) def test_sync_one_arguments( additional_args: list[str], description: str, ) -> None: """Test sync one command requires arguments.""" command_args = ["m2mconfig", "sync", "one"] command_args.extend(additional_args) run_command( command_args, expected_returncode=2, description=description, )