def test_GetNamespaces_MalformedID_ThrowsException(self, mock_stix_scanner):
     patcher = mock.patch('adapters.certuk_mod.publisher.publisher_edge_object.PublisherEdgeObject.__bases__', (mock.MagicMock,))
     with patcher:
         patcher.is_local = True
         mock_stix_scanner.side_effect = PublisherEdgeObjectTests.stix_scanner_setup(
             PublisherEdgeObjectTests.malformed_id)
         edge_object_under_test = PublisherEdgeObject(None)
         edge_object_under_test.id_ = None
         edge_object_under_test.filters = None
         self.assertRaises(Exception, edge_object_under_test.ns_dict)
 def test_GetNamespaces_NoAlias_ReturnsNothing(self, mock_stix_scanner):
     patcher = mock.patch('adapters.certuk_mod.publisher.publisher_edge_object.PublisherEdgeObject.__bases__', (mock.MagicMock,))
     with patcher:
         patcher.is_local = True
         mock_stix_scanner.side_effect = PublisherEdgeObjectTests.stix_scanner_setup(
             PublisherEdgeObjectTests.empty_alias_id)
         edge_object_under_test = PublisherEdgeObject(None)
         edge_object_under_test.id_ = None
         edge_object_under_test.filters = None
         namespaces = edge_object_under_test.ns_dict()
         self.assertEqual(namespaces, {})
 def test_STIXScanner_AnyEdgeObject_CalledWithCorrectArguments(self, mock_stix_scanner):
     patcher = mock.patch('adapters.certuk_mod.publisher.publisher_edge_object.PublisherEdgeObject.__bases__', (mock.MagicMock,))
     with patcher:
         patcher.is_local = True
         mock_stix_scanner.side_effect = PublisherEdgeObjectTests.stix_scanner_setup(
             PublisherEdgeObjectTests.ok_ids)
         mock_root_id = PublisherEdgeObjectTests.ok_ids.keys()[0]
         mock_filter = 'Dummy filter'
         edge_object_under_test = PublisherEdgeObject(None)
         edge_object_under_test.id_ = mock_root_id
         edge_object_under_test.filters = mock_filter
         edge_object_under_test.ns_dict()
         mock_stix_scanner.assert_called_with({'_id': mock_root_id}, mock_filter)
 def test_GetNamespaces_NamespacesOK_ReturnsCorrectValues(self, mock_stix_scanner):
     patcher = mock.patch('adapters.certuk_mod.publisher.publisher_edge_object.PublisherEdgeObject.__bases__', (mock.MagicMock,))
     with patcher:
         patcher.is_local = True
         mock_stix_scanner.side_effect = PublisherEdgeObjectTests.stix_scanner_setup(PublisherEdgeObjectTests.ok_ids)
         edge_object_under_test = PublisherEdgeObject(None)
         edge_object_under_test.id_ = None
         edge_object_under_test.filters = None
         namespaces = edge_object_under_test.ns_dict()
         self.assertEqual(namespaces, {
             'http://www.namespace-1.com': 'Alias_1',
             'http://www.namespace-2.com': 'Alias_2'
         })