Compare commits

..

No commits in common. "main" and "1.0.0.2" have entirely different histories.

3 changed files with 10 additions and 12 deletions

View File

@ -236,13 +236,6 @@ class DBControl:
def delete_application(self, application_uuid):
"""
Deletes a single application from the database
:param application_uuid: the id of the application to delete
:param application_uuid: the id of the application to get
"""
self._application.delete(application_uuid)
def get_city(self, city_id):
"""
Get a single city by id
:param city_id: the id of the city to get
"""
return self._city.get_by_id(city_id)

View File

@ -133,7 +133,3 @@ class City(Repository):
except SQLAlchemyError as err:
logging.error('Error while fetching city by name %s', err)
raise SQLAlchemyError from err
def get_by_id(self, city_id) -> Model:
with Session(self.engine) as session:
return session.execute(select(Model).where(Model.id == city_id)).first()[0]

View File

@ -5,9 +5,18 @@ Copyright © 2022 Concordia CERC group
Project Coder Ruben Sanchez ruben.sanchez@mail.concordia.ca
"""
import datetime
import distutils.spawn
import os
import unittest
from pathlib import Path
from unittest import TestCase
from sqlalchemy import create_engine
from sqlalchemy_utils import database_exists, create_database, drop_database
from cerc_persistence.db_control import DBControl
from cerc_persistence.repository import Repository
from cerc_persistence.models import City, Application, CityObject, SimulationResults, User
from unittests.control import Control
control = Control()