def test_get_orphan_collection_view(self, mock_factory, mock_resp, mock_reverse): """ Orphan collection should create a response from a dict of orphan dicts. """ mock_orphans = { 'orphan1': 1, 'orphan2': 2, } mock_orphan_manager = mock.MagicMock() mock_orphan_manager.orphans_summary.return_value = mock_orphans mock_factory.content_orphan_manager.return_value = mock_orphan_manager request = mock.MagicMock() mock_reverse.return_value = '/mock/path/' orphan_collection = OrphanCollectionView() response = orphan_collection.get(request) expected_content = { 'orphan1': { 'count': 1, '_href': '/mock/path/', }, 'orphan2': { 'count': 2, '_href': '/mock/path/', }, } mock_resp.assert_called_once_with(expected_content) self.assertTrue(response is mock_resp.return_value)