Statistics
| Branch: | Tag: | Revision:

root / test / apitest.py @ 6d34b917

History | View | Annotate | Download (2.3 kB)

1
#!/usr/bin/python
2
from commissioning.clients.http import main, HTTP_API_Client
3
from commissioning import QuotaholderAPI
4
import unittest
5
import ConfigParser
6

    
7

    
8
class QuotaholderHTTP(HTTP_API_Client):
9
    api_spec = QuotaholderAPI()
10

    
11
class Config():
12
    def __init__(self):
13
        config = ConfigParser.RawConfigParser()
14
        read_ok = config.read("apitest.cfg")
15
        if not read_ok:
16
            pass # raise something?
17
        self.qh_url = config.get('global', 'QH_URL')
18
        self.qh = QuotaholderHTTP(self.qh_url)
19

    
20

    
21
    def module_config(mod):
22
        '''Loads the config residing next to the module.'''
23
        import shlex, os.path
24
        cp = ConfigParser.RawConfigParser()
25
        # ''' open(os.path.splitext(mod.__file__)[0] + '.conf')'''
26
        cp.read_file("test.cfg")
27
        return cp
28

    
29
class SimpleAPICall(unittest.TestCase):
30
    def setUp(self):
31
#        print 'In setUp()'
32
#        self.fixture = range(1, 10)
33
#        QH_URL='http://localhost:8008/api/quotaholder/v'
34
#        self.conf = module_config(__name__ + ".cfg")
35
#        self.qh = QuotaholderHTTP(QH_URL)
36
        config = Config()
37
        self.qh = config.qh
38
        print self.qh
39

    
40
    def tearDown(self):
41
#        print 'In tearDown()'
42
        del self.qh
43

    
44
    def test_001_create_entity(self):
45
        rejected = self.qh.create_entity(context={},create_entity=[("pgerakios","system","key1","")])
46
        self.assertEqual(rejected,[])
47

    
48
    def test_002_set_entity_key(self):
49
        pass
50

    
51
    def test_003_list_entities(self):
52
        pass
53

    
54
    def test_004_get_entity(self):
55
        pass
56

    
57
    def test_005_get_limits(self):
58
        pass
59

    
60
    def test_006_set_limits(self):
61
        pass
62

    
63
    def test_007_get_holding(self):
64
        pass
65

    
66
    def test_008_set_holding(self):
67
        pass
68

    
69
    def test_009_list_resources(self):
70
        pass
71

    
72
    def test_010_get_quota(self):
73
        pass
74

    
75
    def test_011_set_quota(self):
76
        pass
77

    
78
    def test_012_issue_commission(self):
79
        pass
80

    
81
    def test_013_accept_commission(self):
82
        pass
83

    
84
    def test_014_reject_commission(self):
85
        pass
86

    
87
    def test_015_get_pending_commissions(self):
88
        pass
89

    
90
    def test_016_resolve_pending_commissions(self):
91
        pass
92

    
93
    def test_017_release_entity(self):
94
        pass
95

    
96
    def test_018_get_timeline(self):
97
        pass
98

    
99

    
100

    
101
if __name__ == "__main__":
102
    unittest.main()