summaryrefslogtreecommitdiffstats
path: root/test/unittest/test_func_arg.py
blob: daec3463ae63041711713ff6e26c51d43cd931d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
##
## Copyright 2007, Red Hat, Inc
## see AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##

#tester module for ArgCompatibility
from func.minion.modules.func_arg import ArgCompatibility

class TestArgCompatibility:
   
    def setUp(self):
        #create the simple object 
        self.ac = ArgCompatibility(self.dummy_arg_getter())

    def test_arg_compatibility(self):
        """
        Testing the method argument compatiblity
        """
        result = self.ac.validate_all()
        #self.assert_on_fault(result)
        assert result == True

    def dummy_arg_getter(self):
        """
        A simple method to test the stuff we have written for 
        arg compatiblity. I just return a dict with proper stuff
        Should more an more tests here to see if didnt miss something
        """
        return {
            'hifunc':{
                
                'app':{
                    'type':'int',
                    'range':(0,100),
                    'optional':False,
                    'default' : 12
                    },
                
                'platform':{
                    'type':'string',
                    'min_length':50,
                    'max_length':100,
                    'options':('fedora8','fedora9','some_other'),'description':"Hey im a fedora fan"
                        },
                
                'is_independent':{
                    'type':'boolean',
                    'default' :False,
                    'description':'Are you independent ?'
                    },
                                
                'some_string':{
                    'type':'string',
                    'validator': "^[a-zA-Z]$",} # validator is a re string for those whoo need better validation...
                        
              }
              }