from datetime import datetime

import pytest

from app.domain.entities import Admin, Host, Service
from app.domain.errors import NoAdministratorFound
from app.repository.sqlalchemy import (SqlalchemyAdminRepo, SqlalchemyHostRepo,
                                       SqlalchemyServiceRepo)
from app.repository.sqlalchemy.models import db
from tests.unit.utils import FlaskAppContextEnvironment


class DbEnvironment(FlaskAppContextEnvironment):
    @pytest.fixture
    def table(self, app_context):
        db.drop_all()
        db.create_all()
        yield
        db.session.remove()
        db.drop_all()