def test_convert_string_fail(self): """ Tests that the parameter fails validation if the group name doesn't exist """ param = Group() param.convert('i_hopefully_dont_exist', None, None)
def test_convert_int_fail(self): """ Tests that the parameter fails validation if the GID doesn't exist """ # This should be way larger than the system limit since its 2^64 group_id = 0x10000000000000000 param = Group() param.convert(group_id, None, None)
def test_convert_int(self): """ Tests that the parameter validates that the GID exists """ expected_gid = os.getgid() param = Group() group = param.convert(expected_gid, None, None) self.assertEqual( expected_gid, group, 'Group ID did not match', )
def test_convert_string(self): """ Tests that the parameter converts a group name into a GID """ expected_gid = os.getgid() current_group = grp.getgrgid(expected_gid).gr_name param = Group() group = param.convert(current_group, None, None) self.assertEqual( expected_gid, group, 'Group ID did not match', )