Skip to content

Commit fc1ce6d

Browse files
committed
Add some tests
1 parent 97d8d73 commit fc1ce6d

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

stix2/sources/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,7 @@ def get(self, id_, _composite_filters=None):
401401
stix_obj (dictionary): the STIX object to be returned
402402
403403
'''
404-
stix_obj = None
405-
406-
return stix_obj
404+
raise NotImplementedError
407405

408406
@abc.abstractmethod
409407
def all_versions(self, id_, _composite_filters=None):

stix2/test/test_data_sources.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pytest
2+
3+
import stix2.sources
4+
5+
6+
def test_data_source():
7+
ds = stix2.sources.DataSource()
8+
9+
assert ds.name == "DataSource"
10+
11+
12+
def test_set_data_source_name():
13+
ds = stix2.sources.DataSource(name="My Data Source")
14+
15+
assert ds.name == "My Data Source"
16+
17+
18+
def test_data_source_get():
19+
ds = stix2.sources.DataSource(name="My Data Source")
20+
21+
with pytest.raises(NotImplementedError):
22+
ds.get("foo")

0 commit comments

Comments
 (0)