def test_mozdefhostname_mock_exception(self, mock_path): mock_path.side_effect = ValueError event = { 'category': 'proxy', 'SOURCE': 'something', 'customendpoint': ' ' } plugin = message() result, metadata = plugin.onMessage(event, self.metadata) assert result['mozdefhostname'] == 'failed to fetch mozdefhostname'
def test_mozdefhostname_mock_string(self, mock_path): mock_path.return_value = 'samplehostname' event = { 'category': 'proxy', 'SOURCE': 'something', 'customendpoint': ' ' } plugin = message() result, metadata = plugin.onMessage(event, self.metadata) assert result['mozdefhostname'] == 'samplehostname'
def setup(self): self.plugin = message() self.metadata = { 'index': 'events' }
def setup(self): self.plugin = message() self.metadata = {'doc_type': 'nsm', 'index': 'events'}
def setup(self): self.plugin = message() self.metadata = { 'doc_type': 'nsm', 'index': 'events' }