Exemple #1
0
def test_modified_content(file_operator, content_level):
    # Test modified
    write_file("Welcome.txt")
    staging_data = file_operator.get_staging_content()
    working_data = file_operator.get_working_directory_content()

    assert "Welcome.txt" in staging_data
    assert staging_data["Welcome.txt"] != working_data["Welcome.txt"]
Exemple #2
0
def test_added_content(file_operator, content_level):
    added_files = ["added.txt", "dir/added.txt", "dir/subdir/added.txt"]

    for added_file in added_files:
        write_file(added_file)
        file_operator.repo.git.add(Path(added_file))

    staging_data = file_operator.get_staging_content()
    working_data = file_operator.get_working_directory_content()

    for added_file in added_files:
        assert added_file in staging_data
        assert added_file in working_data
Exemple #3
0
def test_untracked_content(file_operator, content_level):
    untracked_files = [
        "untracked.txt", "dir/untracked.txt", "dir/subdir/untracked.txt"
    ]

    for filepath in untracked_files:
        write_file(filepath)

    staging_data = file_operator.get_staging_content()
    working_data = file_operator.get_working_directory_content()

    for untracked_file in untracked_files:
        assert untracked_file in working_data
        assert untracked_file not in staging_data
Exemple #4
0
def content_level(gg):
    from gitgud.skills import all_skills
    gg.load_level(all_skills['intro']['welcome'])

    write_file("root.txt")
    os.mkdir("dir")
    write_file("dir/dirfile.txt")
    os.mkdir("dir/subdir")
    write_file("dir/subdir/subdirfile.txt")

    subprocess.call("git add .", shell=True)
    subprocess.call('git commit -m "Testing commit"', shell=True)