Removed the jenkins replace with cerc
This commit is contained in:
parent
60e1686421
commit
404f8d561d
@ -46,7 +46,7 @@ class Control:
|
|||||||
"""
|
"""
|
||||||
self._skip_test = False
|
self._skip_test = False
|
||||||
# Create test database
|
# Create test database
|
||||||
dotenv_path = Path("{}/.local/etc/hub_api/.env".format(os.path.expanduser('~').replace('jenkins', 'cerc'))).resolve()
|
dotenv_path = Path("{}/.local/etc/hub/.env".format(os.path.expanduser('~'))).resolve()
|
||||||
if not dotenv_path.exists():
|
if not dotenv_path.exists():
|
||||||
self._skip_test = True
|
self._skip_test = True
|
||||||
self._skip_reason = f'.env file missing at {dotenv_path}'
|
self._skip_reason = f'.env file missing at {dotenv_path}'
|
||||||
@ -106,19 +106,13 @@ class Control:
|
|||||||
self._application_uuid = 'b9e0ce80-1218-410c-8a64-9d9b7026aad8'
|
self._application_uuid = 'b9e0ce80-1218-410c-8a64-9d9b7026aad8'
|
||||||
self._application_id = 1
|
self._application_id = 1
|
||||||
self._user_id = 1
|
self._user_id = 1
|
||||||
try:
|
|
||||||
self._application_id = self._database.persist_application(
|
|
||||||
'test',
|
|
||||||
'test',
|
|
||||||
self.application_uuid
|
|
||||||
)
|
|
||||||
except sqlalchemy.exc.SQLAlchemyError:
|
|
||||||
self._application_id = self._database.application_info(self.application_uuid).id
|
|
||||||
|
|
||||||
try:
|
self._application_id = self._database.persist_application(
|
||||||
self._user_id = self._database.create_user('test', self._application_id, 'test', UserRoles.Admin)
|
'test',
|
||||||
except sqlalchemy.exc.SQLAlchemyError:
|
'test',
|
||||||
self._user_id = self._database.user_info(name='test', password='test', application_id=self._application_id).id
|
self.application_uuid
|
||||||
|
)
|
||||||
|
self._user_id = self._database.create_user('test', self._application_id, 'test', UserRoles.Admin)
|
||||||
|
|
||||||
self._pickle_path = Path('tests_data/pickle_path.bz2').resolve()
|
self._pickle_path = Path('tests_data/pickle_path.bz2').resolve()
|
||||||
|
|
||||||
@ -279,10 +273,8 @@ TestDBFactory
|
|||||||
{'yearly_cooling_consumption': yearly_cooling_consumption},
|
{'yearly_cooling_consumption': yearly_cooling_consumption},
|
||||||
{'monthly_domestic_hot_water_consumption': monthly_domestic_hot_water_consumption},
|
{'monthly_domestic_hot_water_consumption': monthly_domestic_hot_water_consumption},
|
||||||
{'yearly_domestic_hot_water_consumption': yearly_domestic_hot_water_consumption},
|
{'yearly_domestic_hot_water_consumption': yearly_domestic_hot_water_consumption},
|
||||||
{
|
{'monthly_distribution_systems_electrical_consumption': monthly_distribution_systems_electrical_consumption},
|
||||||
'monthly_distribution_systems_electrical_consumption': monthly_distribution_systems_electrical_consumption},
|
{'yearly_distribution_systems_electrical_consumption': yearly_distribution_systems_electrical_consumption},
|
||||||
{
|
|
||||||
'yearly_distribution_systems_electrical_consumption': yearly_distribution_systems_electrical_consumption},
|
|
||||||
{'monthly_on_site_electrical_production': monthly_on_site_electrical_production},
|
{'monthly_on_site_electrical_production': monthly_on_site_electrical_production},
|
||||||
{'yearly_on_site_electrical_production': yearly_on_site_electrical_production}
|
{'yearly_on_site_electrical_production': yearly_on_site_electrical_production}
|
||||||
]})
|
]})
|
||||||
@ -304,6 +296,3 @@ TestDBFactory
|
|||||||
control.database.delete_application(control.application_uuid)
|
control.database.delete_application(control.application_uuid)
|
||||||
control.database.delete_user(control.user_id)
|
control.database.delete_user(control.user_id)
|
||||||
os.unlink(control.pickle_path)
|
os.unlink(control.pickle_path)
|
||||||
output_files = glob.glob('./tests_outputs/*')
|
|
||||||
for output_file in output_files:
|
|
||||||
os.unlink(output_file)
|
|
||||||
|
@ -109,8 +109,8 @@ control = Control()
|
|||||||
|
|
||||||
class TestDBFactory(TestCase):
|
class TestDBFactory(TestCase):
|
||||||
"""
|
"""
|
||||||
TestDBFactory
|
TestDBFactory
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@unittest.skipIf(control.skip_test, control.skip_reason)
|
@unittest.skipIf(control.skip_test, control.skip_reason)
|
||||||
def test_retrieve_results(self):
|
def test_retrieve_results(self):
|
||||||
@ -129,6 +129,7 @@ class TestDBFactory(TestCase):
|
|||||||
"skin and system retrofit with pv": ["01002777", "01002773", "01036804"]
|
"skin and system retrofit with pv": ["01002777", "01002773", "01036804"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
results = control.database.results(control.user_id, control.application_id, request_values)
|
results = control.database.results(control.user_id, control.application_id, request_values)
|
||||||
|
Loading…
Reference in New Issue
Block a user