def test_get_repo_group_distributors(self, mock_factory, mock_resp, mock_reverse): """ Get all distributors for a repo group. """ mock_request = mock.MagicMock() mock_dist_manager = mock_factory.repo_group_distributor_manager.return_value mock_dist_manager.find_distributors.return_value = [{ 'id': 'dist1' }, { 'id': 'dist2' }] mock_reverse.return_value = '/mock/path/' repo_group_distributors = RepoGroupDistributorsView() response = repo_group_distributors.get(mock_request, 'mock_group_id') expected_content = [{ 'id': 'dist1', '_href': '/mock/path/' }, { 'id': 'dist2', '_href': '/mock/path/' }] mock_resp.assert_called_once_with(expected_content) self.assertTrue(response is mock_resp.return_value) mock_dist_manager.find_distributors.assert_called_once_with( 'mock_group_id')
def test_get_repo_group_distributors(self, mock_factory, mock_resp, mock_reverse): """ Get all distributors for a repo group. """ mock_request = mock.MagicMock() mock_dist_manager = mock_factory.repo_group_distributor_manager.return_value mock_dist_manager.find_distributors.return_value = [{'id': 'dist1'}, {'id': 'dist2'}] mock_reverse.return_value = '/mock/path/' repo_group_distributors = RepoGroupDistributorsView() response = repo_group_distributors.get(mock_request, 'mock_group_id') expected_content = [{'id': 'dist1', '_href': '/mock/path/'}, {'id': 'dist2', '_href': '/mock/path/'}] mock_resp.assert_called_once_with(expected_content) self.assertTrue(response is mock_resp.return_value) mock_dist_manager.find_distributors.assert_called_once_with('mock_group_id')