Script test_bodhi_py
[hide private]
[frames] | no frames]

Source Code for Script script-test_bodhi_py

 1  #!/usr/bin/python -tt 
 2  # This program is free software; you can redistribute it and/or modify 
 3  # it under the terms of the GNU General Public License as published by 
 4  # the Free Software Foundation; either version 2 of the License, or 
 5  # (at your option) any later version. 
 6  # 
 7  # This program is distributed in the hope that it will be useful, 
 8  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 9  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
10  # GNU Library General Public License for more details. 
11  # 
12  # You should have received a copy of the GNU General Public License 
13  # along with this program; if not, write to the Free Software 
14  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
15  # 
16  # Authors: Tim Lauridsen <timlau@fedoraproject.org> 
17   
18  import os 
19   
20  PKG = 'yumex-2.0.1-2.fc7' # This package is a test build i have made in Koji 
21  BODHI = './bodhi-client.py' 
22  IMPORT_FILE  = 'bodhi-test-import' 
23   
24 -def make_import_file(typ,cve=False):
25 f = open(IMPORT_FILE,'w') 26 f.write(': Bodhi update template, all entries starting with a : are ignored\n') 27 f.write('::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n') 28 f.write(':\n') 29 f.write(': Select a type: S=Security, B=Bugfix, E=Enhancement\n') 30 f.write(':\n') 31 f.write('TYPE=%s\n' % typ) 32 f.write(': Select Bug numbers to include or add you own\n') 33 f.write(': You can either use multiple BUG= statements or separate the bug numbers with a space\n') 34 f.write('BUG=282141\n') # This is a existing yumex bug, created for this test 35 f.write(': Select CVE numbers to include or add you own\n') 36 f.write(': You can either use multiple CVE= statements or separate the cve numbers with a space\n') 37 if cve: 38 f.write('CVE=CVE-2344-333\n') 39 f.write(':\n') 40 f.write(': Now edit the update notification message, everything that does not start with a : or\n') 41 f.write(': CVE=, TYPE= or BUG= will be used\n') 42 f.write('This is a yumex test update used to testing\n') 43 f.write('The Bodhi commandline client\n') 44 f.close
45
46 -def run(cmd,msg):
47 print '============================================================================' 48 print msg 49 print "Running : %s \n" % cmd 50 print '--> Output start' 51 os.system(cmd) 52 print '--> Output End' 53 print '\n' 54 55 56 if __name__ == "__main__": 57 # Cleanup 58 cmd = BODHI+" -d "+ PKG 59 run(cmd,"Make sure the update dont exist ") 60 # Test update creation 61 make_import_file('B') 62 cmd = BODHI+" -n "+ PKG + ' --file='+IMPORT_FILE 63 run(cmd,"Create an update (BUGFIX) ") 64 run(cmd,"Create an update there already exist (Should fail) ") 65 # Test push to testing 66 cmd = BODHI+" -T "+ PKG 67 run(cmd,"Push the update to testing ") 68 run(cmd,"Push the update to testing again (Should fail) ") 69 cmd = BODHI+" -S "+ PKG 70 run(cmd,"Push the update to stable (Should fail because it has a pending push) ") 71 # Cleanup 72 cmd = BODHI+" -d "+ PKG 73 run(cmd,"Make sure the update dont exist ") 74 # Test update creation (Security) 75 make_import_file('S',cve = True) 76 cmd = BODHI+" -n "+ PKG + ' --file='+IMPORT_FILE 77 run(cmd,"Create an update (SECURITY) ") 78 # Test push to testing 79 cmd = BODHI+" -T "+ PKG 80 run(cmd,"Push the update to testing (It should go direct to stable, insted of testing ") 81