Skip to content
Snippets Groups Projects
Commit 2371a8ab authored by Remco Tukker's avatar Remco Tukker
Browse files

first half of remaining legacy db publisher

parent d1fe126b
No related branches found
No related tags found
1 merge request!83Feature/comp 284 old db publisher
......@@ -206,7 +206,7 @@ class Standards(db.Model):
crisis_management_procedure: Mapped[Optional[bool]]
class CrisisExcercises(db.Model):
class CrisisExercises(db.Model):
__tablename__ = 'crisis_excercises'
nren_id: Mapped[int_pk_fkNREN]
nren: Mapped[NREN] = relationship(lazy='joined')
......
......
......@@ -18,7 +18,7 @@ from compendium_v2.db import db
from compendium_v2.db.presentation_models import BudgetEntry, ChargingStructure, ECProject, ExternalConnections, \
InstitutionURLs, NrenStaff, ParentOrganization, Policy, SubOrganization, TrafficVolume, ExternalConnection, \
FundingSource, CentralProcurement, ServiceManagement, ServiceUserTypes, EOSCListings, \
Standards, CrisisExcercises, SecurityControls, ConnectedProportion, ConnectivityLevel, \
Standards, CrisisExercises, SecurityControls, ConnectedProportion, ConnectivityLevel, \
ConnectionCarrier, ConnectivityLoad, ConnectivityGrowth, CommercialConnectivity, \
CommercialChargingLevel, RemoteCampuses, DarkFibreLease, DarkFibreInstalled, FibreLight, \
NetworkMapUrls, MonitoringTools, PassiveMonitoring, TrafficStatistics, SiemVendors, \
......@@ -59,7 +59,7 @@ def _map_2023(nren, answers) -> None:
for table_class in [BudgetEntry, ChargingStructure, ECProject, ExternalConnections,
InstitutionURLs, NrenStaff, ParentOrganization, Policy, SubOrganization, TrafficVolume,
FundingSource, CentralProcurement, ServiceManagement, ServiceUserTypes, EOSCListings,
Standards, CrisisExcercises, SecurityControls, ConnectedProportion, ConnectivityLevel,
Standards, CrisisExercises, SecurityControls, ConnectedProportion, ConnectivityLevel,
ConnectionCarrier, ConnectivityLoad, ConnectivityGrowth, CommercialConnectivity,
CommercialChargingLevel, RemoteCampuses, DarkFibreLease, DarkFibreInstalled, FibreLight,
NetworkMapUrls, MonitoringTools, PassiveMonitoring, TrafficStatistics, SiemVendors,
......@@ -210,7 +210,7 @@ def _map_2023(nren, answers) -> None:
crisis_exercises = answers.get("crisis_exercises")
if crisis_exercises:
db.session.add(CrisisExcercises(
db.session.add(CrisisExercises(
nren_id=nren.id, nren=nren, year=year,
exercise_descriptions=crisis_exercises
))
......
......
This diff is collapsed.
......@@ -128,7 +128,7 @@ def test_v2_publisher_full(app):
assert standards.business_continuity_plans_specifics == "no"
assert not standards.crisis_management_procedure
crisis_excercises = db.session.scalar(select(presentation_models.CrisisExcercises))
crisis_excercises = db.session.scalar(select(presentation_models.CrisisExercises))
assert crisis_excercises.exercise_descriptions == [
"geant_workshops", "national_excercises", "tabletop_exercises", "other_excercises",
"none", "simulation_excercises", "real_crisis"
......
......
......@@ -110,7 +110,7 @@ org_dataKTU,"NOC, administrative authority"
]
def test_publisher(app_with_survey_db, mocker, dummy_config):
def test_publisher(app_with_survey_db, mocker):
global org_data
def get_rows_as_tuples(*args, **kwargs):
......@@ -194,18 +194,20 @@ def test_publisher(app_with_survey_db, mocker, dummy_config):
('nren3', 'n.a. online'),
]
def institutions_urls_data():
def institutions_urls_data(question_id):
if question_id == 16507:
return [
(87483, 'ANA', 2013, "http://www.rash.al/index.php/network/points-of-presence-pop"),
(163286, 'ANA', 2014, "http://www.rash.al/index.php/network/points-of-presence-pop"),
]
else:
return []
mocker.patch('compendium_v2.publishers.survey_publisher_old_db_2022.query_budget', get_rows_as_tuples)
mocker.patch('compendium_v2.publishers.survey_publisher_old_db_2022.query_funding_sources', funding_source_data)
mocker.patch('compendium_v2.publishers.survey_publisher_old_db_2022.query_question', question_data)
mocker.patch('compendium_v2.publishers.survey_publisher_old_db_2022.query_question_id', question_id_data)
mocker.patch('compendium_v2.publishers.survey_publisher_old_db_2022.query_institutions_urls',
institutions_urls_data)
mocker.patch('compendium_v2.publishers.survey_publisher_old_db_2022.recursive_query', institutions_urls_data)
nren_names = ['Nren1', 'Nren2', 'Nren3', 'Nren4', 'SURF', 'KIFU', 'University of Malta', 'ASNET-AM',
'SIKT', 'LAT', 'RASH', 'ANAS', 'GRNET', 'CSC']
......@@ -213,7 +215,7 @@ def test_publisher(app_with_survey_db, mocker, dummy_config):
db.session.add_all([presentation_models.NREN(name=nren_name, country='country') for nren_name in nren_names])
db.session.commit()
_cli(dummy_config, app_with_survey_db)
_cli(app_with_survey_db)
with app_with_survey_db.app_context():
budgets = db.session.scalars(
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment