Changeset 3413 for pykota/trunk/tests/filldb.py
- Timestamp:
- 09/27/08 22:02:37 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/tests/filldb.py
r3411 r3413 9 9 # the Free Software Foundation, either version 3 of the License, or 10 10 # (at your option) any later version. 11 # 11 # 12 12 # This program is distributed in the hope that it will be useful, 13 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 15 # GNU General Public License for more details. 16 # 16 # 17 17 # You should have received a copy of the GNU General Public License 18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. … … 32 32 for bname in billingcodes : 33 33 argsfile.write("%s\n" % bname) 34 argsfile.close() 35 os.system('pkbcodes --arguments arguments.list') 34 argsfile.close() 35 os.system('pkbcodes --arguments arguments.list') 36 36 return billingcodes 37 37 … … 43 43 for bname in billingcodes : 44 44 argsfile.write("%s\n" % bname) 45 argsfile.close() 46 os.system('pkbcodes --arguments arguments.list') 47 45 argsfile.close() 46 os.system('pkbcodes --arguments arguments.list') 47 48 48 def createPrinters(number) : 49 49 """Creates a number of printers.""" … … 54 54 for pname in printernames : 55 55 argsfile.write("%s\n" % pname) 56 argsfile.close() 57 os.system('pkprinters --arguments arguments.list') 56 argsfile.close() 57 os.system('pkprinters --arguments arguments.list') 58 58 return printernames 59 59 … … 65 65 for pname in printernames : 66 66 argsfile.write("%s\n" % pname) 67 argsfile.close() 68 os.system('pkprinters --arguments arguments.list') 69 67 argsfile.close() 68 os.system('pkprinters --arguments arguments.list') 69 70 70 def createUsers(number) : 71 71 """Creates a number of users.""" … … 76 76 for uname in usernames : 77 77 argsfile.write("%s\n" % uname) 78 argsfile.close() 79 os.system('pkusers --arguments arguments.list') 78 argsfile.close() 79 os.system('pkusers --arguments arguments.list') 80 80 return usernames 81 81 … … 87 87 for uname in usernames : 88 88 argsfile.write("%s\n" % uname) 89 argsfile.close() 90 os.system('pkusers --arguments arguments.list') 91 89 argsfile.close() 90 os.system('pkusers --arguments arguments.list') 91 92 92 def createGroups(number) : 93 93 """Creates a number of groups.""" … … 98 98 for gname in groupnames : 99 99 argsfile.write("%s\n" % gname) 100 argsfile.close() 101 os.system('pkusers --arguments arguments.list') 100 argsfile.close() 101 os.system('pkusers --arguments arguments.list') 102 102 return groupnames 103 103 … … 109 109 for gname in groupnames : 110 110 argsfile.write("%s\n" % gname) 111 argsfile.close() 112 os.system('pkusers --arguments arguments.list') 113 111 argsfile.close() 112 os.system('pkusers --arguments arguments.list') 113 114 114 def createUserPQuotas(usernames, printernames) : 115 115 """Creates a number of user print quota entries.""" … … 121 121 for uname in usernames : 122 122 argsfile.write("%s\n" % uname) 123 argsfile.close() 124 os.system('edpykota --arguments arguments.list') 123 argsfile.close() 124 os.system('edpykota --arguments arguments.list') 125 125 126 126 def deleteUserPQuotas(usernames, printernames) : … … 133 133 for uname in usernames : 134 134 argsfile.write("%s\n" % uname) 135 argsfile.close() 136 os.system('edpykota --arguments arguments.list') 137 135 argsfile.close() 136 os.system('edpykota --arguments arguments.list') 137 138 138 def createGroupPQuotas(groupnames, printernames) : 139 139 """Creates a number of group print quota entries.""" … … 145 145 for gname in groupnames : 146 146 argsfile.write("%s\n" % gname) 147 argsfile.close() 148 os.system('edpykota --arguments arguments.list') 147 argsfile.close() 148 os.system('edpykota --arguments arguments.list') 149 149 150 150 def deleteGroupPQuotas(groupnames, printernames) : … … 157 157 for gname in groupnames : 158 158 argsfile.write("%s\n" % gname) 159 argsfile.close() 160 os.system('edpykota --arguments arguments.list') 161 162 if __name__ == "__main__" : 159 argsfile.close() 160 os.system('edpykota --arguments arguments.list') 161 162 if __name__ == "__main__" : 163 163 if len(sys.argv) == 1 : 164 164 sys.stderr.write("usage : %s [--nodelete] NbBillingCodes NbPrinters NbUsers NbGroups\n" % sys.argv[0]) 165 else : 165 else : 166 166 delete = True 167 167 args = sys.argv[1:] … … 177 177 if nbprinters : 178 178 printers = createPrinters(nbprinters) 179 if nbusers : 179 if nbusers : 180 180 users = createUsers(nbusers) 181 if nbgroups : 181 if nbgroups : 182 182 groups = createGroups(nbgroups) 183 184 if nbusers and nbprinters : 183 184 if nbusers and nbprinters : 185 185 createUserPQuotas(users, printers) 186 186 if delete : 187 187 deleteUserPQuotas(users, printers) 188 189 if nbgroups and nbprinters : 188 189 if nbgroups and nbprinters : 190 190 createGroupPQuotas(groups, printers) 191 191 if delete : 192 192 deleteGroupPQuotas(groups, printers) 193 194 if delete : 195 if nbbillingcodes : 193 194 if delete : 195 if nbbillingcodes : 196 196 deleteBillingCodes(bcodes) 197 if nbgroups : 197 if nbgroups : 198 198 deleteGroups(groups) 199 if nbusers : 199 if nbusers : 200 200 deleteUsers(users) 201 if nbprinters : 201 if nbprinters : 202 202 deletePrinters(printers) 203 203 os.remove("arguments.list") 204 204