Fix pep8 tests

Lines were too long (> 79)

Change-Id: I9f317b0303dfc61ee7d31fe6c9b8a29f56cae5a9
This commit is contained in:
Sergey Nikitin 2019-04-12 11:43:15 +04:00
parent bed964d2d9
commit 5b90184272
4 changed files with 240 additions and 223 deletions

View File

@ -19,31 +19,33 @@ from stackalytics.tests.api import test_api
class TestAPICompanies(test_api.TestAPI):
def test_get_companies(self):
data = {
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'project_types': [
{'id': 'openstack', 'title': 'OpenStack',
'modules': ['nova', 'glance']}],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'module_group_name': 'openstack',
'modules': ['nova', 'glance']},
'nova': {'module_group_name': 'nova',
'modules': ['nova']},
'glance': {'module_group_name': 'glance',
'modules': ['glance']},
}
}
with test_api.make_runtime_storage(
{
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'project_types': [
{'id': 'openstack', 'title': 'OpenStack',
'modules': ['nova', 'glance']}],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'module_group_name': 'openstack',
'modules': ['nova', 'glance']},
'nova': {'module_group_name': 'nova',
'modules': ['nova']},
'glance': {'module_group_name': 'glance',
'modules': ['glance']},
}},
data,
test_api.make_records(record_type=['commit'],
loc=[10, 20, 30],
module=['glance'],
@ -75,29 +77,30 @@ class TestAPICompanies(test_api.TestAPI):
{'id': 'nec', 'text': 'NEC'}], companies)
def test_get_company(self):
data = {
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'module_groups': {
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance', 'nova-cli']},
{'id': 'openstack', 'title': 'OpenStack',
'modules': ['nova', 'glance']}]}
with test_api.make_runtime_storage(
{
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'module_groups': {
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance', 'nova-cli']},
{'id': 'openstack', 'title': 'OpenStack',
'modules': ['nova', 'glance']}]},
data,
test_api.make_records(record_type=['commit'],
loc=[10, 20, 30],
module=['glance'],

View File

@ -19,32 +19,36 @@ from stackalytics.tests.api import test_api
class TestAPIModules(test_api.TestAPI):
def test_get_modules(self):
data = {
'repos': [
{'module': 'nova', 'organization': 'openstack',
'uri':
'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'organization': 'openstack',
'uri':
'https://git.openstack.org/openstack/glance.git'}
],
'module_groups': {
'nova-group': {'id': 'nova-group',
'module_group_name': 'nova-group',
'modules': ['nova', 'nova-cli'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'nova-cli': test_api.make_module('nova-cli'),
'glance': test_api.make_module('glance'),
},
'releases': [
{'release_name': 'prehistory', 'end_date': 1234567890},
{'release_name': 'icehouse', 'end_date': 1234567890}],
'project_types': [{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance',
'nova-cli']},
{'id': 'integrated',
'title': 'Integrated',
'modules': ['nova', 'glance']}]}
with test_api.make_runtime_storage(
{
'repos': [
{'module': 'nova', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'module_groups': {
'nova-group': {'id': 'nova-group',
'module_group_name': 'nova-group',
'modules': ['nova', 'nova-cli'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'nova-cli': test_api.make_module('nova-cli'),
'glance': test_api.make_module('glance'),
},
'releases': [
{'release_name': 'prehistory', 'end_date': 1234567890},
{'release_name': 'icehouse', 'end_date': 1234567890}],
'project_types': [{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance',
'nova-cli']},
{'id': 'integrated',
'title': 'Integrated',
'modules': ['nova', 'glance']}]},
data,
test_api.make_records(record_type=['commit'],
module=['glance', 'nova', 'nova-cli'])):
@ -74,49 +78,54 @@ class TestAPIModules(test_api.TestAPI):
'project type')
def test_get_module(self):
data = {
'repos': [
{'module': 'nova', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'}],
'module_groups': {
'nova-group': {'id': 'nova-group',
'module_group_name': 'nova-group',
'modules': ['nova-cli', 'nova'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'nova-cli': test_api.make_module('nova-cli'),
},
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance', 'nova-cli']},
{'id': 'openstack', 'title': 'OpenStack',
'modules': ['nova', 'glance']}]}
with test_api.make_runtime_storage(
{
'repos': [
{'module': 'nova', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'}],
'module_groups': {
'nova-group': {'id': 'nova-group',
'module_group_name': 'nova-group',
'modules': ['nova-cli', 'nova'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'nova-cli': test_api.make_module('nova-cli'),
},
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance', 'nova-cli']},
{'id': 'openstack', 'title': 'OpenStack',
'modules': ['nova', 'glance']}]},
data,
test_api.make_records(record_type=['commit'])):
response = self.app.get('/api/1.0/modules/nova')
module = test_api.load_json(response)['module']
self.assertEqual(
{'id': 'nova',
'modules': [
{'module_name': 'nova',
'visible': True,
'repo_uri': 'https://git.openstack.org/openstack/nova.git'}
],
'name': 'Nova', 'tag': 'module'}, module)
expected = {
'id': 'nova',
'modules': [{
'module_name': 'nova',
'visible': True,
'repo_uri': 'https://git.openstack.org/openstack/nova.git'
}],
'name': 'Nova', 'tag': 'module'}
self.assertEqual(expected, module)
response = self.app.get('/api/1.0/modules/nova-group')
module = test_api.load_json(response)['module']
self.assertEqual(
{'id': 'nova-group',
'modules': [{
'module_name': 'nova',
'visible': True,
'repo_uri': 'https://git.openstack.org/openstack/nova.git'},
{'module_name': 'nova-cli', 'visible': False},
],
'name': 'Nova-group', 'tag': 'group'}, module)
expected = {
'id': 'nova-group',
'modules': [{
'module_name': 'nova',
'visible': True,
'repo_uri': 'https://git.openstack.org/openstack/nova.git'
},
{'module_name': 'nova-cli', 'visible': False},
],
'name': 'Nova-group', 'tag': 'group'}
self.assertEqual(expected, module)

View File

@ -19,29 +19,30 @@ from stackalytics.tests.api import test_api
class TestAPIStats(test_api.TestAPI):
def test_get_modules(self):
data = {
'repos': [
{'module': 'nova', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'id': 'openstack',
'module_group_name': 'openstack',
'modules': ['nova', 'glance'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance']}]}
with test_api.make_runtime_storage(
{
'repos': [
{'module': 'nova', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'id': 'openstack',
'module_group_name': 'openstack',
'modules': ['nova', 'glance'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance']}]},
data,
test_api.make_records(record_type=['commit'],
loc=[10, 20, 30],
module=['nova']),
@ -58,40 +59,42 @@ class TestAPIStats(test_api.TestAPI):
self.assertEqual('nova', stats[1]['id'])
def test_get_engineers(self):
data = {
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'id': 'openstack',
'module_group_name': 'openstack',
'modules': ['nova', 'glance'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance']}],
'user:john_doe': {
'seq': 1, 'user_id': 'john_doe',
'user_name': 'John Doe',
'companies': [{'company_name': 'NEC', 'end_date': 0}],
'emails': ['john_doe@gmail.com'], 'core': []},
'user:bill': {
'seq': 1, 'user_id': 'bill', 'user_name': 'Bill Smith',
'companies': [{'company_name': 'IBM', 'end_date': 0}],
'emails': ['bill_smith@gmail.com'], 'core': []}}
with test_api.make_runtime_storage(
{
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'id': 'openstack',
'module_group_name': 'openstack',
'modules': ['nova', 'glance'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance']}],
'user:john_doe': {
'seq': 1, 'user_id': 'john_doe',
'user_name': 'John Doe',
'companies': [{'company_name': 'NEC', 'end_date': 0}],
'emails': ['john_doe@gmail.com'], 'core': []},
'user:bill': {
'seq': 1, 'user_id': 'bill', 'user_name': 'Bill Smith',
'companies': [{'company_name': 'IBM', 'end_date': 0}],
'emails': ['bill_smith@gmail.com'], 'core': []}},
data,
test_api.make_records(record_type=['commit'],
loc=[10, 20, 30],
module=['nova'],
@ -114,41 +117,43 @@ class TestAPIStats(test_api.TestAPI):
self.assertEqual(660, stats[0]['metric'])
def test_get_engineers_extended(self):
data = {
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'id': 'openstack',
'module_group_name': 'openstack',
'modules': ['nova', 'glance'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance']}],
'user:john_doe': {
'seq': 1, 'user_id': 'john_doe',
'user_name': 'John Doe',
'companies': [{'company_name': 'NEC', 'end_date': 0}],
'emails': ['john_doe@gmail.com'], 'core': []},
'user:smith': {
'seq': 1, 'user_id': 'smith',
'user_name': 'Bill Smith',
'companies': [{'company_name': 'IBM', 'end_date': 0}],
'emails': ['bill_smith@gmail.com'], 'core': []}}
with test_api.make_runtime_storage(
{
'repos': [
{'module': 'nova', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/nova.git'},
{'module': 'glance', 'project_type': 'openstack',
'organization': 'openstack',
'uri': 'https://git.openstack.org/openstack/glance.git'}
],
'releases': [{'release_name': 'prehistory',
'end_date': 1234567890},
{'release_name': 'icehouse',
'end_date': 1234567890}],
'module_groups': {
'openstack': {'id': 'openstack',
'module_group_name': 'openstack',
'modules': ['nova', 'glance'],
'tag': 'group'},
'nova': test_api.make_module('nova'),
'glance': test_api.make_module('glance'),
},
'project_types': [
{'id': 'all', 'title': 'All',
'modules': ['nova', 'glance']}],
'user:john_doe': {
'seq': 1, 'user_id': 'john_doe',
'user_name': 'John Doe',
'companies': [{'company_name': 'NEC', 'end_date': 0}],
'emails': ['john_doe@gmail.com'], 'core': []},
'user:smith': {
'seq': 1, 'user_id': 'smith',
'user_name': 'Bill Smith',
'companies': [{'company_name': 'IBM', 'end_date': 0}],
'emails': ['bill_smith@gmail.com'], 'core': []}},
data,
test_api.make_records(record_type=['commit'],
loc=[10, 20, 30],
module=['nova'],

View File

@ -58,33 +58,33 @@ class TestDefaultDataProcessor(testtools.TestCase):
message='The last company end date should be 0')
def test_update_project_list(self):
return_value = [
{'module': 'nova',
'uri': 'https://git.openstack.org/openstack/nova',
'organization': 'openstack'},
{'module': 'qa', 'uri': 'https://git.openstack.org/openstack/qa',
'has_gerrit': True,
'organization': 'openstack'},
{'module': 'deb-nova',
'uri': 'https://git.openstack.org/openstack/deb-nova',
'organization': 'openstack'},
]
dd = {
'repos': [
{'module': 'qa',
'uri': 'https://git.openstack.org/openstack/qa',
'organization': 'openstack'},
{'module': 'tux',
'uri': 'https://git.openstack.org/stackforge/tux',
'organization': 'stackforge'},
],
'project_sources': [{'organization': 'openstack',
'uri': 'gerrit://'}],
'module_groups': [],
}
with mock.patch('stackalytics.processor.default_data_processor.'
'_retrieve_project_list_from_gerrit') as retriever:
retriever.return_value = [
{'module': 'nova',
'uri': 'https://git.openstack.org/openstack/nova',
'organization': 'openstack'},
{'module': 'qa', 'uri': 'https://git.openstack.org/openstack/qa',
'has_gerrit': True,
'organization': 'openstack'},
{'module': 'deb-nova',
'uri': 'https://git.openstack.org/openstack/deb-nova',
'organization': 'openstack'},
]
dd = {
'repos': [
{'module': 'qa',
'uri': 'https://git.openstack.org/openstack/qa',
'organization': 'openstack'},
{'module': 'tux',
'uri': 'https://git.openstack.org/stackforge/tux',
'organization': 'stackforge'},
],
'project_sources': [{'organization': 'openstack',
'uri': 'gerrit://'}],
'module_groups': [],
}
retriever.return_value = return_value
default_data_processor._update_project_list(dd)
self.assertEqual(3, len(dd['repos']))