'Helper method checking the calls to C{os.seteuid} and C{os.setegid}
made by L{util.runAsEffectiveUser}, when switching from startUID to
wantUID and from startGID to wantGID.'

def _testUIDGIDSwitch(self, startUID, startGID, wantUID, wantGID, expectedUIDSwitches, expectedGIDSwitches):

    self.mockos.euid = startUID
    self.mockos.egid = startGID
    util.runAsEffectiveUser(wantUID, wantGID, self._securedFunction, startUID, startGID, wantUID, wantGID)
    self.assertEqual(self.mockos.seteuidCalls, expectedUIDSwitches)
    self.assertEqual(self.mockos.setegidCalls, expectedGIDSwitches)
    self.mockos.seteuidCalls = []
    self.mockos.setegidCalls = []
