| 76 | def createGroups(number) : |
| 77 | """Creates a number of groups.""" |
| 78 | sys.stdout.write("Adding %i groups...\n" % number) |
| 79 | groupnames = [ "test-group-%05i" % i for i in range(number) ] |
| 80 | argsfile = open("arguments.list", "w") |
| 81 | argsfile.write('--groups\n--add\n--limitby\nquota\n--description\n"a group"\n') |
| 82 | for gname in groupnames : |
| 83 | argsfile.write("%s\n" % gname) |
| 84 | argsfile.close() |
| 85 | os.system('pkusers --arguments arguments.list') |
| 86 | return groupnames |
| 87 | |
| 88 | def deleteGroups(groupnames) : |
| 89 | """Deletes all test groups.""" |
| 90 | sys.stdout.write("Deleting groups...\n") |
| 91 | argsfile = open("arguments.list", "w") |
| 92 | argsfile.write('--groups\n--delete\n') |
| 93 | for gname in groupnames : |
| 94 | argsfile.write("%s\n" % gname) |
| 95 | argsfile.close() |
| 96 | os.system('pkusers --arguments arguments.list') |
| 97 | |
| 122 | def createGroupPQuotas(groupnames, printernames) : |
| 123 | """Creates a number of group print quota entries.""" |
| 124 | number = len(groupnames) * len(printernames) |
| 125 | sys.stdout.write("Adding %i group print quota entries...\n" % number) |
| 126 | argsfile = open("arguments.list", "w") |
| 127 | argsfile.write('--groups\n--add\n--softlimit\n100\n--hardlimit\n110\n--reset\n--hardreset\n--printer\n') |
| 128 | argsfile.write("%s\n" % ",".join(printernames)) |
| 129 | for gname in groupnames : |
| 130 | argsfile.write("%s\n" % gname) |
| 131 | argsfile.close() |
| 132 | os.system('edpykota --arguments arguments.list') |
| 133 | |
| 134 | def deleteGroupPQuotas(groupnames, printernames) : |
| 135 | """Deletes all test group print quota entries.""" |
| 136 | number = len(groupnames) * len(printernames) |
| 137 | sys.stdout.write("Deleting group print quota entries...\n") |
| 138 | argsfile = open("arguments.list", "w") |
| 139 | argsfile.write('--groups\n--delete\n--printer\n') |
| 140 | argsfile.write("%s\n" % ",".join(printernames)) |
| 141 | for gname in groupnames : |
| 142 | argsfile.write("%s\n" % gname) |
| 143 | argsfile.close() |
| 144 | os.system('edpykota --arguments arguments.list') |
| 145 | |