def test_update_project_list_ext_project_source(self): with mock.patch('stackalytics.processor.default_data_processor.' '_retrieve_project_list_from_github') as retriever: retriever.return_value = [ {'module': 'kubernetes', 'uri': 'git://github.com/kubernetes/kubernetes', 'organization': 'kubernetes'}, ] dd = { 'repos': [], 'project_sources': [ {'organization': 'kubernetes', 'uri': 'github://', 'module_group_id': 'kubernetes-group'}, ], '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'])
def test_update_project_list_ext_project_source(self): with mock.patch('stackalytics.processor.default_data_processor.' '_retrieve_project_list_from_github') as retriever: retriever.return_value = [ {'module': 'kubernetes', 'uri': 'git://github.com/kubernetes/kubernetes', 'organization': 'kubernetes'}, ] dd = { 'repos': [], 'project_sources': [ {'organization': 'kubernetes', 'uri': 'github://', 'module_group_id': 'kubernetes-group'}, ], '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'])
def test_update_project_list(self): with mock.patch('stackalytics.processor.default_data_processor.' '_retrieve_project_list_from_github') as retriever: retriever.return_value = [ {'module': 'nova', 'uri': 'git://github.com/openstack/nova', 'organization': 'openstack'}, {'module': 'qa', 'uri': 'git://github.com/openstack/qa', 'organization': 'openstack'}, ] dd = { 'repos': [ {'module': 'qa', 'uri': 'git://github.com/openstack/qa', 'organization': 'openstack'}, {'module': 'tux', 'uri': 'git://github.com/stackforge/tux', 'organization': 'stackforge'}, ], 'project_sources': [{'organization': 'openstack', 'module_group_name': 'OpenStack'}], 'module_groups': [], } default_data_processor._update_project_list(dd) self.assertEqual(3, len(dd['repos'])) self.assertIn('qa', set([r['module'] for r in dd['repos']])) self.assertIn('nova', set([r['module'] for r in dd['repos']])) self.assertIn('tux', set([r['module'] for r in dd['repos']])) self.assertEqual(2, len(dd['module_groups'])) self.assertIn({'module_group_name': 'OpenStack', 'modules': ['qa', 'nova'], 'tag': 'organization'}, dd['module_groups']) self.assertIn({'module_group_name': 'stackforge', 'modules': ['tux'], 'tag': 'organization'}, dd['module_groups'])
def test_update_project_list(self): with mock.patch('stackalytics.processor.default_data_processor.' '_retrieve_project_list_from_gerrit') as retriever: retriever.return_value = [ { 'module': 'nova', 'uri': 'git://git.openstack.org/openstack/nova', 'organization': 'openstack' }, { 'module': 'qa', 'uri': 'git://git.openstack.org/openstack/qa', 'organization': 'openstack' }, ] dd = { 'repos': [ { 'module': 'qa', 'uri': 'git://git.openstack.org/openstack/qa', 'organization': 'openstack' }, { 'module': 'tux', 'uri': 'git://git.openstack.org/stackforge/tux', 'organization': 'stackforge' }, ], 'project_sources': [{ 'organization': 'openstack', 'uri': 'gerrit://' }], 'module_groups': [], } default_data_processor._update_project_list(dd) self.assertEqual(3, len(dd['repos'])) self.assertIn('qa', set([r['module'] for r in dd['repos']])) self.assertIn('nova', set([r['module'] for r in dd['repos']])) self.assertIn('tux', set([r['module'] for r in dd['repos']])) self.assertEqual(2, len(dd['module_groups'])) self.assertIn( { 'id': 'openstack', 'module_group_name': 'openstack', 'modules': ['qa', 'nova'], 'tag': 'organization' }, dd['module_groups']) self.assertIn( { 'id': 'stackforge', 'module_group_name': 'stackforge', 'modules': ['tux'], 'tag': 'organization' }, dd['module_groups'])
def test_update_project_list(self): with mock.patch('stackalytics.processor.default_data_processor.' '_retrieve_project_list_from_github') as retriever: retriever.return_value = [ {'module': 'nova', 'uri': 'git://github.com/openstack/nova'}, {'module': 'qa', 'uri': 'git://github.com/openstack/qa'}, ] dd = { 'repos': [ {'module': 'qa', 'uri': 'git://github.com/openstack/qa'}, ], 'project_sources': ['any'] } default_data_processor._update_project_list(dd) self.assertEqual(2, len(dd['repos'])) self.assertIn('qa', set([r['module'] for r in dd['repos']])) self.assertIn('nova', set([r['module'] for r in dd['repos']]))