forked from Katello/katello
-
Notifications
You must be signed in to change notification settings - Fork 0
/
system_group_create_test.py
60 lines (45 loc) · 1.87 KB
/
system_group_create_test.py
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
import unittest
import os
from katello.tests.core.action_test_utils import CLIOptionTestCase, CLIActionTestCase
from katello.tests.core.organization import organization_data
from katello.tests.core.system import system_data
import katello.client.core.system_group
from katello.client.core.system_group import Create
class RequiredCLIOptionsTests(CLIOptionTestCase):
#requires: organization, name
#optional: maximum systems, description
action = Create()
disallowed_options = [
(),
('--org=ACME', ),
('--name=system_group_1',),
('--description="This is a system group"'),
('--max_systems=35'),
('--org=ACME', '--max_systems=35'),
('--org=ACME', '-description="This is a system group"'),
]
allowed_options = [
('--org=ACME', '--name=system'),
('--org=ACME', '--name=system', '--max_systems=6'),
('--org=ACME', '--name=system', '--description="This is a desc"'),
('--org=ACME', '--name=system', '--description="This is a desc"', '--max_systems=6')
]
class SystemGroupCreateTest(CLIActionTestCase):
ORG = organization_data.ORGS[0]
SYSTEM_GROUP = system_data.SYSTEM_GROUPS[1]
OPTIONS = {
'org': ORG['name'],
'name': SYSTEM_GROUP['name'],
'description': SYSTEM_GROUP['description'],
'max_systems' : 5
}
def setUp(self):
self.set_action(Create())
self.set_module(katello.client.core.system_group)
self.mock_printer()
self.mock_options(self.OPTIONS)
self.mock(self.action.api, 'create', self.SYSTEM_GROUP)
def test_it_calls_system_group_create_api(self):
self.run_action()
self.action.api.create.assert_called_once_with(self.OPTIONS['org'], self.OPTIONS['name'],
self.OPTIONS['description'], self.OPTIONS['max_systems'])