Fix commit validation and add unit tests

The ValidateServiceUserCommits was broken in many ways. In this [1]
change the else clause was mistakenly removed. After [1], even if there
are active owners the creator status is still checked and when the
creator is inactive the validation fails.

However, even before [1] the code was broken: if the owner group was set
and all members were inactive then validation would immediately fail
without checking the creator status. So even if the creator was
active the validation would fail in this case.

This change makes the code easier to read by checking the positive cases
first and exiting early, as soon as it detects that the validation will

Add unit tests to cover all possible combinations of the creator and
owner group status.


Change-Id: I3e86eadb4caea85170184566f475a81856b628d2
2 files changed