import repository from arizona
[raven.git] / 2.0 / python / test / stork_nestrpm_prepare_packageTest.py
1 #! /usr/bin/env python
2 """
3 <Module>
4    storktrustedpackagesTest
5 <Author>
6    Justin Cappos
7 <Started>
8    November 10, 2005   
9 <Purpose>
10    Test module for stork.  See stork_nest_rpm_prepare.py for more details.
11 """
12
13 import arizonaunittest
14 import arizonaconfig
15 import stork_nest_rpm_prepare
16 import os
17 import shutil
18
19 # Unit tests for each function, listed in code order
20 class test(arizonaunittest.TestCase):
21
22    #------------------------------------------------------------------
23    # def prepare(filename, directory):
24    #------------------------------------------------------------------
25    def test_prepare(self):
26  
27       try:
28          shutil.rmtree("/tmp/foo")
29       except OSError:
30          pass
31
32       
33       #file does not exist
34       self.assertException(TypeError, stork_nest_rpm_prepare.prepare,"/tmp/junk/wllksfdgkjlsdaklfjgldj.rpm","/tmp/foo")
35       
36       #not an rpm
37       self.assertException(TypeError, stork_nest_rpm_prepare.prepare,"/bin/ls","/tmp/foo")
38       stork_nest_rpm_prepare.prepare("/tmp/junk/mem_test-1.0.0-1.i386.rpm","/tmp/foo")
39       
40
41
42
43 # Run tests
44 if __name__ == '__main__':
45    arizonaconfig.init_options() 
46    arizonaunittest.main()