Example #1
0
import yaml
from pynonymizer.log import get_default_logger
from pynonymizer.database import get_temp_db_name, get_provider
from pynonymizer.fake import FakeColumnGenerator
from pynonymizer.strategy.parser import StrategyParser
from pynonymizer.strategy.config import read_config
from pynonymizer.exceptions import ArgumentValidationError, DatabaseConnectionError
from pynonymizer.process_steps import StepActionMap, ProcessSteps


logger = get_default_logger()


def pynonymize(
        input_path=None, strategyfile_path=None, output_path=None, db_user=None, db_password=None, db_type=None,
        db_host=None, db_name=None, db_port=None, fake_locale=None, start_at_step=None, stop_at_step=None, skip_steps=None,
        seed_rows=None, dry_run=False, verbose=False,

        **kwargs
    ):

    # Default and Normalize args
    if start_at_step is None:
        start_at_step = ProcessSteps.START
    else:
        start_at_step = ProcessSteps.from_value(start_at_step)

    if stop_at_step is None:
        stop_at_step = ProcessSteps.END
    else:
        stop_at_step = ProcessSteps.from_value(stop_at_step)
Example #2
0
def test_get_default_logger(get_logger_mock):
    logger = get_default_logger()
    get_logger_mock.assert_called_once_with("pynonymizer")