Skip to content

Commit

Permalink
Fix new smart group creation algorithm and tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shea Craig committed Aug 20, 2015
1 parent b7025df commit a8db3fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions jss/jss.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,13 +1135,11 @@ def new(self, name, **kwargs):
"""
element_name = ElementTree.SubElement(self, "name")
element_name.text = name
self.is_smart = ElementTree.SubElement(self, "is_smart")
if 'smart' in kwargs.keys():
smartness = kwargs['smart']
else:
smartness = False
self.set_bool(self.is_smart, smartness)
# is_smart is a JSSGroupObject @property.
ElementTree.SubElement(self, "is_smart")
self.criteria = ElementTree.SubElement(self, "criteria")
# Assing smartness if specified, otherwise default to False.
self.is_smart = kwargs.get("smart", False)
self.computers = ElementTree.SubElement(self, "computers")

def add_computer(self, device):
Expand Down
5 changes: 3 additions & 2 deletions test/jss_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ def test_ComputerGroup_Smart(self):
cg.findtext("criteria/criterion/name")
cg.save()
assert_is_instance(cg, ComputerGroup)
assert_true(bool(cg.findtext("is_smart")))
assert_equals(cg.findtext("criteria/criterion/name"), "Computer Name")
assert_true(cg.is_smart)
assert_equals(cg.findall("criteria/criterion/name")[0].text,
"Computer Name")
cg.delete()

def test_PackageTemplate(self):
Expand Down

0 comments on commit a8db3fb

Please sign in to comment.