# Path: stackalytics/processor/default_data_processor.py
# LOG = logging.getLogger(__name__)
# GITHUB_URI_PREFIX = r'^github:\/\/'
# STORE_FUNCS = {
#     'users': _store_users,
#     'companies': _store_companies,
#     'module_groups': _store_module_groups,
# }
# def _check_default_data_change(runtime_storage_inst, default_data):
# def _retrieve_project_list_from_sources(project_sources):
# def _retrieve_project_list_from_gerrit(project_source):
# def _retrieve_project_list_from_github(project_source):
# def _create_module_groups_for_project_sources(project_sources, repos):
# def _update_project_list(default_data):
# def _update_with_driverlog_data(default_data, driverlog_data_uri):
# def _store_users(runtime_storage_inst, users):
# def _store_companies(runtime_storage_inst, companies):
# def _store_module_groups(runtime_storage_inst, module_groups):
# def _store_default_data(runtime_storage_inst, default_data):
# def process(runtime_storage_inst, default_data, driverlog_data_uri):
# 
# Path: stackalytics/processor/normalizer.py
# LOG = logging.getLogger(__name__)
# NORMALIZERS = {
#     'users': _normalize_users,
#     'releases': _normalize_releases,
#     'repos': _normalize_repos,
# }
# def _normalize_user(user):
#     def end_date_comparator(x, y):
# def _normalize_users(users):
# def _normalize_releases(releases):
# def _normalize_repos(repos):
# def normalize_default_data(default_data):


import copy
import mock
import testtools
from stackalytics.processor import default_data_processor
from stackalytics.processor import normalizer
from stackalytics.tests.unit import test_data
                'module_groups': [],
            }

            default_data_processor._update_project_list(dd)

            self.assertEqual(1, len(dd['repos']))
            self.assertIn('kubernetes',
                          set([r['module'] for r in dd['repos']]))

            self.assertEqual(1, len(dd['module_groups']))
            self.assertIn({'id': 'kubernetes-group',
                           'module_group_name': 'kubernetes',
                           'modules': ['kubernetes'],
                           'tag': 'organization'}, dd['module_groups'])

    @mock.patch('stackalytics.processor.utils.read_json_from_uri')
    def test_update_with_driverlog(self, mock_read_from_json):
        default_data = {'repos': [{'module': 'cinder', }], 'users': []}
        driverlog_dd = {'drivers': [{
            'project_id': 'openstack/cinder',
            'vendor': 'VMware',
            'name': 'VMware VMDK Driver',
            'ci': {
                'id': 'vmwareminesweeper',
                'success_pattern': 'Build successful',
                'failure_pattern': 'Build failed'
            }
        }]}
        mock_read_from_json.return_value = driverlog_dd


# Path: stackalytics/processor/default_data_processor.py
# LOG = logging.getLogger(__name__)
# GITHUB_URI_PREFIX = r'^github:\/\/'
# STORE_FUNCS = {
#     'users': _store_users,
#     'companies': _store_companies,
#     'module_groups': _store_module_groups,
# }
# def _check_default_data_change(runtime_storage_inst, default_data):
# def _retrieve_project_list_from_sources(project_sources):
# def _retrieve_project_list_from_gerrit(project_source):
# def _retrieve_project_list_from_github(project_source):
# def _create_module_groups_for_project_sources(project_sources, repos):
# def _update_project_list(default_data):
# def _update_with_driverlog_data(default_data, driverlog_data_uri):
# def _store_users(runtime_storage_inst, users):
# def _store_companies(runtime_storage_inst, companies):
# def _store_module_groups(runtime_storage_inst, module_groups):
# def _store_default_data(runtime_storage_inst, default_data):
# def process(runtime_storage_inst, default_data, driverlog_data_uri):
# 
# Path: stackalytics/processor/normalizer.py
# LOG = logging.getLogger(__name__)
# NORMALIZERS = {
#     'users': _normalize_users,
#     'releases': _normalize_releases,
#     'repos': _normalize_repos,
# }
# def _normalize_user(user):
#     def end_date_comparator(x, y):
# def _normalize_users(users):
# def _normalize_releases(releases):
# def _normalize_repos(repos):
# def normalize_default_data(default_data):


# Path: stackalytics/tests/unit/test_default_data_processor.py
import copy
import mock
import testtools
from stackalytics.processor import default_data_processor
from stackalytics.processor import normalizer
from stackalytics.tests.unit import test_data

                'module_groups': [],
            }

            default_data_processor._update_project_list(dd)

            self.assertEqual(1, len(dd['repos']))
            self.assertIn('kubernetes',
                          set([r['module'] for r in dd['repos']]))

            self.assertEqual(1, len(dd['module_groups']))
            self.assertIn({'id': 'kubernetes-group',
                           'module_group_name': 'kubernetes',
                           'modules': ['kubernetes'],
                           'tag': 'organization'}, dd['module_groups'])

    @mock.patch('stackalytics.processor.utils.read_json_from_uri')
    def test_update_with_driverlog(self, mock_read_from_json):
        default_data = {'repos': [{'module': 'cinder', }], 'users': []}
        driverlog_dd = {'drivers': [{
            'project_id': 'openstack/cinder',
            'vendor': 'VMware',
            'name': 'VMware VMDK Driver',
            'ci': {
                'id': 'vmwareminesweeper',
                'success_pattern': 'Build successful',
                'failure_pattern': 'Build failed'
            }
        }]}
        mock_read_from_json.return_value = driverlog_dd


        default_data_processor._update_with_driverlog_data(default_data, 'uri')