Skip to content

Commit

Permalink
Return single observable correctly. Fix #309
Browse files Browse the repository at this point in the history
  • Loading branch information
gtback committed Oct 27, 2016
1 parent 5b0f411 commit f7f90a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion stix/indicator/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ def observables(self):
elif self.observable.observable_composition:
return self.observable.observable_composition.observables

return []
# self.observable is defined and not a composition.
return [self.observable]

@observables.setter
def observables(self, value):
Expand Down
3 changes: 2 additions & 1 deletion stix/test/indicator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ def test_observables_property_standard(self):

ind2 = Indicator.from_dict(ind.to_dict())

self.assertEqual([obs], ind2.observables)
self.assertEqual([obs.to_dict()],
[x.to_dict() for x in ind2.observables])


class RelatedCampaignReferencesTests(unittest.TestCase, EntityTestCase):
Expand Down

0 comments on commit f7f90a8

Please sign in to comment.