def testListGroupsNoArgument(self, capsys): self.args += ["listgroups"] self.cli.invoke(self.args, strict=True) out, err = capsys.readouterr() ids = get_group_ids(out) roles = self.sf.getAdminService().getSecurityRoles() assert ids == [roles.userGroupId, self.group.id.val]
def testInfoNoArgument(self, capsys): self.args += ["info"] self.cli.invoke(self.args, strict=True) # Read from the stdout out, err = capsys.readouterr() ids = get_group_ids(out) assert ids == [self.group.id.val]
def testList(self, capsys, sort_key, group_format): self.args += ["list"] if sort_key: self.args += ["--sort-by-%s" % sort_key] if group_format: self.args += ["--%s" % group_format] self.cli.invoke(self.args, strict=True) # Read from the stdout out, err = capsys.readouterr() ids = get_group_ids(out, sort_key=sort_key) # Check all groups are listed if sort_key == 'name': self.groups.sort(key=lambda x: x.name.val) else: self.groups.sort(key=lambda x: x.id.val) assert ids == [group.id.val for group in self.groups]