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