def test_add_remove_composite_datasource(): cds = CompositeDataSource() ds1 = MemorySource() ds2 = MemorySource() ds3 = MemorySink() with pytest.raises(TypeError) as excinfo: cds.add_data_sources([ds1, ds2, ds1, ds3]) assert str(excinfo.value) == ("DataSource (to be added) is not of type " "stix2.DataSource. DataSource type is '<class 'stix2.datastore.memory.MemorySink'>'") cds.add_data_sources([ds1, ds2, ds1]) assert len(cds.get_all_data_sources()) == 2 cds.remove_data_sources([ds1.id, ds2.id]) assert len(cds.get_all_data_sources()) == 0
def test_sink_mixed(indicator): # just make sure there is no crash msink = MemorySink([TLP_GREEN, indicator]) msink.add([TLP_GREEN, indicator])
def test_sink_markings(): # just make sure there is no crash msink = MemorySink(TLP_GREEN) msink.add(TLP_GREEN)