Fix pep8 tests
Lines were too long (> 79) Change-Id: I9f317b0303dfc61ee7d31fe6c9b8a29f56cae5a9
This commit is contained in:
parent
bed964d2d9
commit
5b90184272
|
@ -19,8 +19,7 @@ from stackalytics.tests.api import test_api
|
||||||
class TestAPICompanies(test_api.TestAPI):
|
class TestAPICompanies(test_api.TestAPI):
|
||||||
|
|
||||||
def test_get_companies(self):
|
def test_get_companies(self):
|
||||||
with test_api.make_runtime_storage(
|
data = {
|
||||||
{
|
|
||||||
'repos': [
|
'repos': [
|
||||||
{'module': 'nova', 'project_type': 'openstack',
|
{'module': 'nova', 'project_type': 'openstack',
|
||||||
'organization': 'openstack',
|
'organization': 'openstack',
|
||||||
|
@ -43,7 +42,10 @@ class TestAPICompanies(test_api.TestAPI):
|
||||||
'modules': ['nova']},
|
'modules': ['nova']},
|
||||||
'glance': {'module_group_name': 'glance',
|
'glance': {'module_group_name': 'glance',
|
||||||
'modules': ['glance']},
|
'modules': ['glance']},
|
||||||
}},
|
}
|
||||||
|
}
|
||||||
|
with test_api.make_runtime_storage(
|
||||||
|
data,
|
||||||
test_api.make_records(record_type=['commit'],
|
test_api.make_records(record_type=['commit'],
|
||||||
loc=[10, 20, 30],
|
loc=[10, 20, 30],
|
||||||
module=['glance'],
|
module=['glance'],
|
||||||
|
@ -75,8 +77,7 @@ class TestAPICompanies(test_api.TestAPI):
|
||||||
{'id': 'nec', 'text': 'NEC'}], companies)
|
{'id': 'nec', 'text': 'NEC'}], companies)
|
||||||
|
|
||||||
def test_get_company(self):
|
def test_get_company(self):
|
||||||
with test_api.make_runtime_storage(
|
data = {
|
||||||
{
|
|
||||||
'repos': [
|
'repos': [
|
||||||
{'module': 'nova', 'project_type': 'openstack',
|
{'module': 'nova', 'project_type': 'openstack',
|
||||||
'organization': 'openstack',
|
'organization': 'openstack',
|
||||||
|
@ -97,7 +98,9 @@ class TestAPICompanies(test_api.TestAPI):
|
||||||
{'id': 'all', 'title': 'All',
|
{'id': 'all', 'title': 'All',
|
||||||
'modules': ['nova', 'glance', 'nova-cli']},
|
'modules': ['nova', 'glance', 'nova-cli']},
|
||||||
{'id': 'openstack', 'title': 'OpenStack',
|
{'id': 'openstack', 'title': 'OpenStack',
|
||||||
'modules': ['nova', 'glance']}]},
|
'modules': ['nova', 'glance']}]}
|
||||||
|
with test_api.make_runtime_storage(
|
||||||
|
data,
|
||||||
test_api.make_records(record_type=['commit'],
|
test_api.make_records(record_type=['commit'],
|
||||||
loc=[10, 20, 30],
|
loc=[10, 20, 30],
|
||||||
module=['glance'],
|
module=['glance'],
|
||||||
|
|
|
@ -19,13 +19,14 @@ from stackalytics.tests.api import test_api
|
||||||
class TestAPIModules(test_api.TestAPI):
|
class TestAPIModules(test_api.TestAPI):
|
||||||
|
|
||||||
def test_get_modules(self):
|
def test_get_modules(self):
|
||||||
with test_api.make_runtime_storage(
|
data = {
|
||||||
{
|
|
||||||
'repos': [
|
'repos': [
|
||||||
{'module': 'nova', 'organization': 'openstack',
|
{'module': 'nova', 'organization': 'openstack',
|
||||||
'uri': 'https://git.openstack.org/openstack/nova.git'},
|
'uri':
|
||||||
|
'https://git.openstack.org/openstack/nova.git'},
|
||||||
{'module': 'glance', 'organization': 'openstack',
|
{'module': 'glance', 'organization': 'openstack',
|
||||||
'uri': 'https://git.openstack.org/openstack/glance.git'}
|
'uri':
|
||||||
|
'https://git.openstack.org/openstack/glance.git'}
|
||||||
],
|
],
|
||||||
'module_groups': {
|
'module_groups': {
|
||||||
'nova-group': {'id': 'nova-group',
|
'nova-group': {'id': 'nova-group',
|
||||||
|
@ -44,7 +45,10 @@ class TestAPIModules(test_api.TestAPI):
|
||||||
'nova-cli']},
|
'nova-cli']},
|
||||||
{'id': 'integrated',
|
{'id': 'integrated',
|
||||||
'title': 'Integrated',
|
'title': 'Integrated',
|
||||||
'modules': ['nova', 'glance']}]},
|
'modules': ['nova', 'glance']}]}
|
||||||
|
|
||||||
|
with test_api.make_runtime_storage(
|
||||||
|
data,
|
||||||
test_api.make_records(record_type=['commit'],
|
test_api.make_records(record_type=['commit'],
|
||||||
module=['glance', 'nova', 'nova-cli'])):
|
module=['glance', 'nova', 'nova-cli'])):
|
||||||
|
|
||||||
|
@ -74,8 +78,7 @@ class TestAPIModules(test_api.TestAPI):
|
||||||
'project type')
|
'project type')
|
||||||
|
|
||||||
def test_get_module(self):
|
def test_get_module(self):
|
||||||
with test_api.make_runtime_storage(
|
data = {
|
||||||
{
|
|
||||||
'repos': [
|
'repos': [
|
||||||
{'module': 'nova', 'organization': 'openstack',
|
{'module': 'nova', 'organization': 'openstack',
|
||||||
'uri': 'https://git.openstack.org/openstack/nova.git'}],
|
'uri': 'https://git.openstack.org/openstack/nova.git'}],
|
||||||
|
@ -95,28 +98,34 @@ class TestAPIModules(test_api.TestAPI):
|
||||||
{'id': 'all', 'title': 'All',
|
{'id': 'all', 'title': 'All',
|
||||||
'modules': ['nova', 'glance', 'nova-cli']},
|
'modules': ['nova', 'glance', 'nova-cli']},
|
||||||
{'id': 'openstack', 'title': 'OpenStack',
|
{'id': 'openstack', 'title': 'OpenStack',
|
||||||
'modules': ['nova', 'glance']}]},
|
'modules': ['nova', 'glance']}]}
|
||||||
|
|
||||||
|
with test_api.make_runtime_storage(
|
||||||
|
data,
|
||||||
test_api.make_records(record_type=['commit'])):
|
test_api.make_records(record_type=['commit'])):
|
||||||
|
|
||||||
response = self.app.get('/api/1.0/modules/nova')
|
response = self.app.get('/api/1.0/modules/nova')
|
||||||
module = test_api.load_json(response)['module']
|
module = test_api.load_json(response)['module']
|
||||||
self.assertEqual(
|
expected = {
|
||||||
{'id': 'nova',
|
'id': 'nova',
|
||||||
'modules': [
|
|
||||||
{'module_name': 'nova',
|
|
||||||
'visible': True,
|
|
||||||
'repo_uri': 'https://git.openstack.org/openstack/nova.git'}
|
|
||||||
],
|
|
||||||
'name': 'Nova', 'tag': 'module'}, module)
|
|
||||||
|
|
||||||
response = self.app.get('/api/1.0/modules/nova-group')
|
|
||||||
module = test_api.load_json(response)['module']
|
|
||||||
self.assertEqual(
|
|
||||||
{'id': 'nova-group',
|
|
||||||
'modules': [{
|
'modules': [{
|
||||||
'module_name': 'nova',
|
'module_name': 'nova',
|
||||||
'visible': True,
|
'visible': True,
|
||||||
'repo_uri': 'https://git.openstack.org/openstack/nova.git'},
|
'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']
|
||||||
|
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},
|
{'module_name': 'nova-cli', 'visible': False},
|
||||||
],
|
],
|
||||||
'name': 'Nova-group', 'tag': 'group'}, module)
|
'name': 'Nova-group', 'tag': 'group'}
|
||||||
|
self.assertEqual(expected, module)
|
||||||
|
|
|
@ -19,8 +19,7 @@ from stackalytics.tests.api import test_api
|
||||||
class TestAPIStats(test_api.TestAPI):
|
class TestAPIStats(test_api.TestAPI):
|
||||||
|
|
||||||
def test_get_modules(self):
|
def test_get_modules(self):
|
||||||
with test_api.make_runtime_storage(
|
data = {
|
||||||
{
|
|
||||||
'repos': [
|
'repos': [
|
||||||
{'module': 'nova', 'organization': 'openstack',
|
{'module': 'nova', 'organization': 'openstack',
|
||||||
'uri': 'https://git.openstack.org/openstack/nova.git'},
|
'uri': 'https://git.openstack.org/openstack/nova.git'},
|
||||||
|
@ -41,7 +40,9 @@ class TestAPIStats(test_api.TestAPI):
|
||||||
},
|
},
|
||||||
'project_types': [
|
'project_types': [
|
||||||
{'id': 'all', 'title': 'All',
|
{'id': 'all', 'title': 'All',
|
||||||
'modules': ['nova', 'glance']}]},
|
'modules': ['nova', 'glance']}]}
|
||||||
|
with test_api.make_runtime_storage(
|
||||||
|
data,
|
||||||
test_api.make_records(record_type=['commit'],
|
test_api.make_records(record_type=['commit'],
|
||||||
loc=[10, 20, 30],
|
loc=[10, 20, 30],
|
||||||
module=['nova']),
|
module=['nova']),
|
||||||
|
@ -58,8 +59,7 @@ class TestAPIStats(test_api.TestAPI):
|
||||||
self.assertEqual('nova', stats[1]['id'])
|
self.assertEqual('nova', stats[1]['id'])
|
||||||
|
|
||||||
def test_get_engineers(self):
|
def test_get_engineers(self):
|
||||||
with test_api.make_runtime_storage(
|
data = {
|
||||||
{
|
|
||||||
'repos': [
|
'repos': [
|
||||||
{'module': 'nova', 'project_type': 'openstack',
|
{'module': 'nova', 'project_type': 'openstack',
|
||||||
'organization': 'openstack',
|
'organization': 'openstack',
|
||||||
|
@ -91,7 +91,10 @@ class TestAPIStats(test_api.TestAPI):
|
||||||
'user:bill': {
|
'user:bill': {
|
||||||
'seq': 1, 'user_id': 'bill', 'user_name': 'Bill Smith',
|
'seq': 1, 'user_id': 'bill', 'user_name': 'Bill Smith',
|
||||||
'companies': [{'company_name': 'IBM', 'end_date': 0}],
|
'companies': [{'company_name': 'IBM', 'end_date': 0}],
|
||||||
'emails': ['bill_smith@gmail.com'], 'core': []}},
|
'emails': ['bill_smith@gmail.com'], 'core': []}}
|
||||||
|
|
||||||
|
with test_api.make_runtime_storage(
|
||||||
|
data,
|
||||||
test_api.make_records(record_type=['commit'],
|
test_api.make_records(record_type=['commit'],
|
||||||
loc=[10, 20, 30],
|
loc=[10, 20, 30],
|
||||||
module=['nova'],
|
module=['nova'],
|
||||||
|
@ -114,8 +117,7 @@ class TestAPIStats(test_api.TestAPI):
|
||||||
self.assertEqual(660, stats[0]['metric'])
|
self.assertEqual(660, stats[0]['metric'])
|
||||||
|
|
||||||
def test_get_engineers_extended(self):
|
def test_get_engineers_extended(self):
|
||||||
with test_api.make_runtime_storage(
|
data = {
|
||||||
{
|
|
||||||
'repos': [
|
'repos': [
|
||||||
{'module': 'nova', 'project_type': 'openstack',
|
{'module': 'nova', 'project_type': 'openstack',
|
||||||
'organization': 'openstack',
|
'organization': 'openstack',
|
||||||
|
@ -148,7 +150,10 @@ class TestAPIStats(test_api.TestAPI):
|
||||||
'seq': 1, 'user_id': 'smith',
|
'seq': 1, 'user_id': 'smith',
|
||||||
'user_name': 'Bill Smith',
|
'user_name': 'Bill Smith',
|
||||||
'companies': [{'company_name': 'IBM', 'end_date': 0}],
|
'companies': [{'company_name': 'IBM', 'end_date': 0}],
|
||||||
'emails': ['bill_smith@gmail.com'], 'core': []}},
|
'emails': ['bill_smith@gmail.com'], 'core': []}}
|
||||||
|
|
||||||
|
with test_api.make_runtime_storage(
|
||||||
|
data,
|
||||||
test_api.make_records(record_type=['commit'],
|
test_api.make_records(record_type=['commit'],
|
||||||
loc=[10, 20, 30],
|
loc=[10, 20, 30],
|
||||||
module=['nova'],
|
module=['nova'],
|
||||||
|
|
|
@ -58,9 +58,7 @@ class TestDefaultDataProcessor(testtools.TestCase):
|
||||||
message='The last company end date should be 0')
|
message='The last company end date should be 0')
|
||||||
|
|
||||||
def test_update_project_list(self):
|
def test_update_project_list(self):
|
||||||
with mock.patch('stackalytics.processor.default_data_processor.'
|
return_value = [
|
||||||
'_retrieve_project_list_from_gerrit') as retriever:
|
|
||||||
retriever.return_value = [
|
|
||||||
{'module': 'nova',
|
{'module': 'nova',
|
||||||
'uri': 'https://git.openstack.org/openstack/nova',
|
'uri': 'https://git.openstack.org/openstack/nova',
|
||||||
'organization': 'openstack'},
|
'organization': 'openstack'},
|
||||||
|
@ -84,7 +82,9 @@ class TestDefaultDataProcessor(testtools.TestCase):
|
||||||
'uri': 'gerrit://'}],
|
'uri': 'gerrit://'}],
|
||||||
'module_groups': [],
|
'module_groups': [],
|
||||||
}
|
}
|
||||||
|
with mock.patch('stackalytics.processor.default_data_processor.'
|
||||||
|
'_retrieve_project_list_from_gerrit') as retriever:
|
||||||
|
retriever.return_value = return_value
|
||||||
default_data_processor._update_project_list(dd)
|
default_data_processor._update_project_list(dd)
|
||||||
|
|
||||||
self.assertEqual(3, len(dd['repos']))
|
self.assertEqual(3, len(dd['repos']))
|
||||||
|
|
Loading…
Reference in New Issue