Code Duplication    Length = 17-21 lines in 2 locations

tests/test_context.py 2 locations

@@ 672-692 (lines=21) @@
669
    assert cc_cfg['module_name'] == 'image_module_maker'
670
671
672
def test_load_context_with_input_with_validation_failure(mocker, capsys):
673
    cc = load_cookiecutter('tests/test-context/cookiecutter_val_failure.json')
674
675
    INPUT_1 = '6 Debug Shell'
676
    INPUT_2 = ''
677
    INPUT_3 = 'debug_shell'
678
    mocker.patch(
679
        'click.termui.visible_prompt_func',
680
        autospec=True,
681
        side_effect=[INPUT_1, INPUT_2, INPUT_3]
682
    )
683
684
    cc_cfg = context.load_context(cc['cookiecutter_val_failure'], no_input=False)
685
686
    out, err = capsys.readouterr()
687
688
    msg = "Input validation failure against regex: '^[a-z_]+$', try again!"
689
    assert msg in out
690
691
    assert cc_cfg['project_name'] == INPUT_1
692
    assert cc_cfg['module_name'] == INPUT_3
693
@@ 634-650 (lines=17) @@
631
    assert repr(cct) == "<CookiecutterTemplate cookiecutter_template_repr_test>"
632
633
634
def test_load_context_with_input_chioces(mocker):
635
    cc = load_cookiecutter('tests/test-context/cookiecutter_choices.json')
636
637
    INPUT_1 = 'E.R. Uber'
638
    INPUT_2 = '[email protected]'
639
    INPUT_3 = '2'  # 'MIT'
640
    mocker.patch(
641
        'click.termui.visible_prompt_func',
642
        autospec=True,
643
        side_effect=[INPUT_1, INPUT_2, INPUT_3]
644
    )
645
646
    cc_cfg = context.load_context(cc['cookiecutter_choices'], no_input=False)
647
648
    assert cc_cfg['full_name'] == INPUT_1
649
    assert cc_cfg['email'] == INPUT_2
650
    assert cc_cfg['license'] == 'MIT'
651
652
653
def test_load_context_with_input_with_validation_success(mocker):