root / test / limits.py @ a812c719
History | View | Annotate | Download (833 Bytes)
1 | 902f1fb9 | Christos KK Loverdos | from kkconfig import QHTestCase |
---|---|---|---|
2 | f6a99346 | Christos KK Loverdos | from kkconfig import run_test_case |
3 | a812c719 | Christos KK Loverdos | from kkconfig import printf |
4 | 902f1fb9 | Christos KK Loverdos | |
5 | 902f1fb9 | Christos KK Loverdos | class LimitsTest(QHTestCase): |
6 | 902f1fb9 | Christos KK Loverdos | def test_01_set_get(self): |
7 | 902f1fb9 | Christos KK Loverdos | policy = 'Some policy'
|
8 | 902f1fb9 | Christos KK Loverdos | quantity = 0
|
9 | 902f1fb9 | Christos KK Loverdos | capacity = 100
|
10 | 902f1fb9 | Christos KK Loverdos | importLimit = 10
|
11 | 902f1fb9 | Christos KK Loverdos | exportLimit = 10
|
12 | 902f1fb9 | Christos KK Loverdos | |
13 | 902f1fb9 | Christos KK Loverdos | # SET
|
14 | 902f1fb9 | Christos KK Loverdos | rejected = self.qh.set_limits(
|
15 | 902f1fb9 | Christos KK Loverdos | context = {}, |
16 | 902f1fb9 | Christos KK Loverdos | set_limits = [ |
17 | 902f1fb9 | Christos KK Loverdos | (policy, quantity, capacity, importLimit, exportLimit) |
18 | 902f1fb9 | Christos KK Loverdos | ] |
19 | 902f1fb9 | Christos KK Loverdos | ) |
20 | 902f1fb9 | Christos KK Loverdos | |
21 | 902f1fb9 | Christos KK Loverdos | self.assertEqual([], rejected)
|
22 | 902f1fb9 | Christos KK Loverdos | |
23 | 902f1fb9 | Christos KK Loverdos | # GET
|
24 | 902f1fb9 | Christos KK Loverdos | limits = self.qh.get_limits(
|
25 | 902f1fb9 | Christos KK Loverdos | context = {}, |
26 | a812c719 | Christos KK Loverdos | get_limits = [policy] # or is it just policy, i.e. no
|
27 | 902f1fb9 | Christos KK Loverdos | ) |
28 | 902f1fb9 | Christos KK Loverdos | |
29 | a812c719 | Christos KK Loverdos | self.assertTrue(len(limits) == 1) |
30 | f6a99346 | Christos KK Loverdos | |
31 | f6a99346 | Christos KK Loverdos | if __name__ == "__main__": |
32 | 7f479bb1 | Christos KK Loverdos | import sys |
33 | a812c719 | Christos KK Loverdos | printf("Using {0}", sys.executable)
|
34 | f6a99346 | Christos KK Loverdos | run_test_case(LimitsTest) |