mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
232: Added Option2.get_values() method; added corresponding unit tests
This commit is contained in:
parent
85f7a08e5d
commit
adf8b9b2d8
@ -152,6 +152,11 @@ class Option2(plugable.ReadOnly):
|
||||
return self.convert(default)
|
||||
return self.convert(self.default)
|
||||
|
||||
def get_values(self):
|
||||
if self.type.name in ('Enum', 'CallbackEnum'):
|
||||
return self.type.values
|
||||
return tuple()
|
||||
|
||||
|
||||
class Option(plugable.Plugin):
|
||||
"""
|
||||
|
@ -291,6 +291,18 @@ class test_Option2(ClassChecker):
|
||||
assert o.get_default() == (default,)
|
||||
assert o.get_default(first='John', last='Doe') == ('Hello, John Doe!',)
|
||||
|
||||
def test_get_default(self):
|
||||
"""
|
||||
Tests the `public.Option2.get_values` method.
|
||||
"""
|
||||
name = 'status'
|
||||
doc = 'Account status'
|
||||
values = (u'Active', u'Inactive')
|
||||
o = self.cls(name, doc, ipa_types.Unicode())
|
||||
assert o.get_values() == tuple()
|
||||
o = self.cls(name, doc, ipa_types.Enum(*values))
|
||||
assert o.get_values() == values
|
||||
|
||||
|
||||
class test_Option(ClassChecker):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user