Tracking branch material (useful for understanding the concepts) -
The current implementation uses git-rev-list, which lists commits that are reachable by following the parent links from the given commit(s), but excludes commits that are reachable from the one(s) given with a ^ in front of them.
You can think of 'git-rev-list' as a set operation. Commits given on the command line form a set of commits that are reachable from any of them, and then commits reachable from any of the ones given with ^in front are subtracted from that set. The remaining commits are what comes out in the command’s output.
Shaurya STests that have been written (from project description)-
Calling delete_branch() with and without the merged_only flag set, ensuring that execute() is called with the right arguments (2 tests). You'll need to use a KGB function spy for this.
Calling create_commit() with the various possible arguments, ensuring that edit_text() is/isn't called (depending) and that execute() is called with the right arguments. Each unique condition should have a test.
Calling merge() with the various possible arguments. Similar to the above. You'll also need to simulate error conditions (which you can do with KGB), and check the resulting exception.
Calling push_upstream() with the various possible arguments, and checking the exceptions in certain cases.
Wrote the following test cases for the following methods of the the GitClient class -
Method name - push_upstream() -
1) Tested push_upstream() with an invalid target branch. The 'git_pull' must raise a PushError exception.
2) Tested push_upstream() with the push_url set to be an invalid one. Neither the 'pull' or the 'push' must raise an exception because it gets it's origin_url from the Git config which still has a valid fetch_url
Method name - merge()
1) Tested merge() with invalid target and destination branches. Both of these must raise a MergeError exception
2) Tested merge() with squash set to True and False. Used a KGB spy to check if execute was called with the right arguments.
Method name - create_commit()
1) Tested create_commit() with run_editor set to True and False. Used a KGB spy to check if edit_text was called or not.
2) Tested create_commit() with all_files set to True and False. Used a KGB spy to check if execute was called with the right arguments.
Method name - delete_branch()
1) Tested delete_branch() with merged_only set to True and False. Used a KGB spy to check if execute was called with the right arguments.
Tests that need to be written (from project description) -
Calling scan_for_server() with a git-svn repository that has a reviewboard:url property on the root of the repository. (You'd need to set this on the SVN repository we have stored inrbtools/clients/testdata/svn-repo), and make sure the result matches.