1+ import pytest
12import os
23
34def test_git_package_is_installed_ (host ):
@@ -15,4 +16,27 @@ def test_git_shell_prompt_is_configured_in_bashrc_d_(host):
1516 assert git_ps1 .contains ('export PS1=' )
1617
1718def test_git_shell_prompt_is_set_in_the_environment_ (host ):
18- assert '__git_ps1' in host .run ('bash -i -c "env | grep ^PS1=; exit \\ $?"' ).stdout
19+ assert '__git_ps1' in host .run ('bash -i -c "env | grep ^PS1=; exit \\ $?"' ).stdout
20+
21+
22+ def test_gitconfig_configures_rebase_on_pull_ (host ):
23+ __assert_git_config (host , 'pull.rebase' , 'true' )
24+
25+ def test_gitconfig_configures_autocrlf_input_ (host ):
26+ __assert_git_config (host , 'core.autocrlf' , 'input' )
27+
28+ @pytest .mark .parametrize ('shortcut,command' , [
29+ ('co' , 'checkout' ),
30+ ('ci' , 'commit' ),
31+ ('br' , 'branch' ),
32+ ('st' , 'status' ),
33+ ('unstage' , 'reset HEAD --' ),
34+ ('slog' , 'log --pretty=oneline --abbrev-commit' ),
35+ ('graph' , 'log --all --oneline --graph --decorate' )
36+ ])
37+ def test_gitconfig_provides_alias_ (host , shortcut , command ):
38+ __assert_git_config (host , f"alias.{ shortcut } " , command )
39+
40+ def __assert_git_config (host , config_key , expected_value ):
41+ actual_value = host .run (f"git config --global --get { config_key } " ).stdout .strip ()
42+ assert actual_value == expected_value
0 commit comments