def test_generator_export_to_server():
    """Generator for tests relating to remote server repository creation.

    This will move into a temporary directory before returning the tests with
    the given script and settings list.

    When called by nosetests, nosetests will run every yielded test function.

    Yields:
        A :class:`system_testing.SystemTest` instance.

    """
    alter_settings_dictionaries(settings_list)

    tempdir = tempfile.mkdtemp()
    cwd = os.getcwd()

    # Unpack tar in tempdir and change to match currently logged in user.
    snm_util.untar_comparison_files_and_insert_user_login(
            COMPARISON_FILES + ".tar.gz", tempdir
    )

    os.chdir(tempdir)

    for test in st.generate_tests_from_dicts("dls-start-new-module.py",
                                             settings_list):
        yield test

    os.chdir(cwd)

    shutil.rmtree(tempdir)
def test_generator_export_to_server():
    """Generator for tests relating to remote server repository creation.

    This will move into a temporary directory before returning the tests with
    the given script and settings list.

    When called by nosetests, nosetests will run every yielded test function.

    Yields:
        A :class:`system_testing.SystemTest` instance.

    """
    alter_settings_dictionaries(settings_list)

    tempdir = tempfile.mkdtemp()
    cwd = os.getcwd()

    # Unpack tar in tempdir and change to match currently logged in user.
    snm_util.untar_comparison_files_and_insert_user_login(
            COMPARISON_FILES + ".tar.gz", tempdir
    )

    os.chdir(tempdir)

    for test in st.generate_tests_from_dicts("dls-start-new-module.py",
                                             settings_list):
        yield test

    os.chdir(cwd)

    shutil.rmtree(tempdir)
def test_generator_local():
    """Generator for tests relating to local repository creation.

    This will move into a temporary directory before returning the tests with
    the given script and settings list.

    When called by nosetests, nosetests will run every yielded test function.

    Yields:
        A :class:`system_testing.SystemTest` instance.

    """
    # Search the COMPARISON_FILES folder for folders to compare with.
    for settings_dict in settings_list:
        # Path used by multiple fields; only input one to avoid duplication.
        path = settings_dict['path']

        settings_dict['local_repo_path'] = path
        settings_dict['local_comp_path_one'] = path

        # Search the COMPARISON_FILES folder for folders to compare with.
        settings_dict['local_comp_path_two'] = os.path.join(
                COMPARISON_FILES,
                path
        )

    tempdir = tempfile.mkdtemp()
    cwd = os.getcwd()

    # Unpack tar in tempdir and change to match currently logged in user.
    snm_util.untar_comparison_files_and_insert_user_login(
            COMPARISON_FILES + ".tar.gz", tempdir
    )

    os.chdir(tempdir)

    for test in st.generate_tests_from_dicts("dls-start-new-module.py -n",
                                             settings_list):
        yield test

    os.chdir(cwd)

    shutil.rmtree(tempdir)
def test_generator_export_add_app_to_server():
    """Generator for tests where an app is added to a pre-existing repository.

    This will move into a temporary directory to run the tests with the given
    script and settings list.

    When called by nosetests, nosetests will run every yielded test function.

    Yields:
        A :class:`system_testing.SystemTest` instance.

    """
    for settings_dict in add_app_settings_list:
        # Set the server repository to the default to start with.

        settings_dict['default_server_repo_path'] = os.path.join(
                ORIGINAL_GIT_ROOT_DIR,
                settings_dict['module_area'],
                settings_dict['path'],
        )

    alter_settings_dictionaries(add_app_settings_list)

    tempdir = tempfile.mkdtemp()
    cwd = os.getcwd()

    # Unpack tar in tempdir and change to match currently logged in user.
    snm_util.untar_comparison_files_and_insert_user_login(
            COMPARISON_FILES + ".tar.gz", tempdir
    )

    os.chdir(tempdir)

    for test in st.generate_tests_from_dicts("dls-start-new-module.py",
                                             add_app_settings_list):
        yield test

    os.chdir(cwd)

    shutil.rmtree(tempdir)
def test_generator_export_add_app_to_server():
    """Generator for tests where an app is added to a pre-existing repository.

    This will move into a temporary directory to run the tests with the given
    script and settings list.

    When called by nosetests, nosetests will run every yielded test function.

    Yields:
        A :class:`system_testing.SystemTest` instance.

    """
    for settings_dict in add_app_settings_list:
        # Set the server repository to the default to start with.

        settings_dict['default_server_repo_path'] = os.path.join(
                ORIGINAL_GIT_ROOT_DIR,
                settings_dict['module_area'],
                settings_dict['path'],
        )

    alter_settings_dictionaries(add_app_settings_list)

    tempdir = tempfile.mkdtemp()
    cwd = os.getcwd()

    # Unpack tar in tempdir and change to match currently logged in user.
    snm_util.untar_comparison_files_and_insert_user_login(
            COMPARISON_FILES + ".tar.gz", tempdir
    )

    os.chdir(tempdir)

    for test in st.generate_tests_from_dicts("dls-start-new-module.py",
                                             add_app_settings_list):
        yield test

    os.chdir(cwd)

    shutil.rmtree(tempdir)
def test_generator_local():
    """Generator for tests relating to local repository creation.

    This will move into a temporary directory before returning the tests with
    the given script and settings list.

    When called by nosetests, nosetests will run every yielded test function.

    Yields:
        A :class:`system_testing.SystemTest` instance.

    """
    # Search the COMPARISON_FILES folder for folders to compare with.
    for settings_dict in settings_list:
        # Path used by multiple fields; only input one to avoid duplication.
        path = settings_dict['path']

        settings_dict['local_repo_path'] = path
        settings_dict['local_comp_path_one'] = path

        # Search the COMPARISON_FILES folder for folders to compare with.
        settings_dict['local_comp_path_two'] = path

    tempdir = tempfile.mkdtemp()
    cwd = os.getcwd()

    # Unpack tar in tempdir and change to match currently logged in user.
    snm_util.untar_comparison_files_and_insert_user_login(
        COMPARISON_FILES + ".tar.gz", tempdir)

    os.chdir(tempdir)

    for test in st.generate_tests_from_dicts("dls-start-new-module.py -n",
                                             settings_list):
        yield test

    os.chdir(cwd)

    shutil.rmtree(tempdir)