def test_command_sync_tables(self, capsys): """Test run tap command""" args = CliArgs(target="target_one", tap="tap_one") pipelinewise = PipelineWise(args, CONFIG_DIR, VIRTUALENVS_DIR) # Running sync_tables should detect the tap type and path to the connector # Since the executable is not available in this test then it should fail # TODO: sync discover_tap and run_tap behaviour. run_tap sys.exit but discover_tap does not. with pytest.raises(SystemExit) as pytest_wrapped_e: pipelinewise.sync_tables() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1
def _assert_calling_sync_tables(pipelinewise: PipelineWise, side_effect_method: Optional[Callable] = None) -> None: with patch('pipelinewise.cli.pipelinewise.PipelineWise.run_tap_fastsync') as mocked_fastsync: if side_effect_method: mocked_fastsync.side_effect = side_effect_method pipelinewise.sync_tables() mocked_fastsync.assert_called_once()