Revision f611ef3d
b/test/__main__.py | ||
---|---|---|
2 | 2 |
import sys |
3 | 3 |
from kkquotaholderapi import KKQuotaHolderAPITest |
4 | 4 |
from limits import LimitsTest |
5 |
from createrelease import CreateReleaseListAPITest |
|
5 | 6 |
|
6 | 7 |
# The following trick is from from snf-tools/synnefo_tools/burnin.py: |
7 | 8 |
# Use backported unittest functionality if Python < 2.7 |
... | ... | |
20 | 21 |
# to run them all |
21 | 22 |
|
22 | 23 |
all_cases = [ |
24 |
CreateReleaseListAPITest, |
|
23 | 25 |
KKQuotaHolderAPITest, |
24 | 26 |
LimitsTest |
25 | 27 |
] |
... | ... | |
33 | 35 |
# Thank you John Giannelos <johngian@grnet.gr> |
34 | 36 |
suite = unittest.TestLoader().loadTestsFromTestCase(test_case) |
35 | 37 |
runner = unittest.TextTestRunner(stream = sys.stderr, verbosity = 2, failfast = True, buffer = False) |
36 |
result = runner.run(suite) |
|
38 |
result = runner.run(suite) |
b/test/createrelease.py | ||
---|---|---|
1 |
|
|
2 |
|
|
3 |
from kkconfig import unittest |
|
4 |
from kkconfig import new_quota_holder_client |
|
5 |
from kkconfig import rand_string |
|
6 |
import os |
|
7 |
|
|
8 |
class CreateReleaseListAPITest(unittest.TestCase): |
|
9 |
def setUp(self): |
|
10 |
self.qh = new_quota_holder_client() |
|
11 |
|
|
12 |
def tearDown(self): |
|
13 |
del self.qh |
|
14 |
|
|
15 |
#BUG: empty entity worked ... |
|
16 |
#BUG: max empty name |
|
17 |
def test_001(self): |
|
18 |
string_length = 10 |
|
19 |
entityName = rand_string() |
|
20 |
parentName = "system" |
|
21 |
entityKey = "key1" |
|
22 |
parentKey = "" |
|
23 |
print("Creating random string: {0}".format(entityName)) |
|
24 |
rejected = self.qh.create_entity(context={}, |
|
25 |
create_entity=[(entityName,parentName,entityKey,parentKey)]) |
|
26 |
self.assertEqual(rejected,[]) |
|
27 |
print("Releasing random string: {0}".format(entityName)) |
|
28 |
rejected = self.qh.release_entity(context={},release_entity=[(entityName,entityKey)]) |
|
29 |
self.assertEqual(rejected,[]) |
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
if __name__ == "__main__": |
|
34 |
unittest.main() |
b/test/kkconfig.py | ||
---|---|---|
13 | 13 |
|
14 | 14 |
from commissioning.clients.http import HTTP_API_Client |
15 | 15 |
from commissioning import QuotaholderAPI |
16 |
import random |
|
16 | 17 |
|
17 | 18 |
### DEFS ### |
18 | 19 |
def new_quota_holder_client(): |
... | ... | |
25 | 26 |
global QH_URL |
26 | 27 |
return QuotaholderHTTP(QH_URL) |
27 | 28 |
|
29 |
def rand_string(): |
|
30 |
alphabet = 'abcdefghijklmnopqrstuvwxyz' |
|
31 |
min = 5 |
|
32 |
max = 15 |
|
33 |
string='' |
|
34 |
for x in random.sample(alphabet,random.randint(min,max)): |
|
35 |
string += x |
|
36 |
return string |
|
37 |
|
|
28 | 38 |
### CLASSES ### |
29 | 39 |
class QHTestCase(unittest.TestCase): |
30 | 40 |
def setUp(self): |
/dev/null | ||
---|---|---|
1 |
|
|
2 |
# We import our own unittest :) |
|
3 |
from kkconfig import unittest |
|
4 |
from kkconfig import new_quota_holder_client |
|
5 |
|
|
6 |
|
|
7 |
class KKQuotaHolderAPITest(unittest.TestCase): |
|
8 |
def setUp(self): |
|
9 |
self.qh = new_quota_holder_client() |
|
10 |
|
|
11 |
def tearDown(self): |
|
12 |
del self.qh |
|
13 |
|
|
14 |
def test_001_create_entity(self): |
|
15 |
pass |
|
16 |
|
|
17 |
def test_002_set_entity_key(self): |
|
18 |
pass |
|
19 |
|
|
20 |
def test_003_list_entities(self): |
|
21 |
pass |
|
22 |
|
|
23 |
def test_004_get_entity(self): |
|
24 |
pass |
|
25 |
|
|
26 |
def test_005_get_limits(self): |
|
27 |
pass |
|
28 |
|
|
29 |
def test_006_set_limits(self): |
|
30 |
pass |
|
31 |
|
|
32 |
def test_007_get_holding(self): |
|
33 |
pass |
|
34 |
|
|
35 |
def test_008_set_holding(self): |
|
36 |
pass |
|
37 |
|
|
38 |
def test_009_list_resources(self): |
|
39 |
pass |
|
40 |
|
|
41 |
def test_010_get_quota(self): |
|
42 |
pass |
|
43 |
|
|
44 |
def test_011_set_quota(self): |
|
45 |
pass |
|
46 |
|
|
47 |
def test_012_issue_commission(self): |
|
48 |
pass |
|
49 |
|
|
50 |
def test_013_accept_commission(self): |
|
51 |
pass |
|
52 |
|
|
53 |
def test_014_reject_commission(self): |
|
54 |
pass |
|
55 |
|
|
56 |
def test_015_get_pending_commissions(self): |
|
57 |
pass |
|
58 |
|
|
59 |
def test_016_resolve_pending_commissions(self): |
|
60 |
pass |
|
61 |
|
|
62 |
def test_017_release_entity(self): |
|
63 |
pass |
|
64 |
|
|
65 |
def test_018_get_timeline(self): |
|
66 |
pass |
|
67 |
|
|
68 |
|
|
69 |
if __name__ == "__main__": |
|
70 |
unittest.main() |
Also available in: Unified diff