Beispiel #1
0
    def decorate(*args, **kwargs):
        if not has_app_context():
            app = create_app()

            with app.app_context():
                return function(*args, **kwargs)

        else:
            return function(*args, **kwargs)
Beispiel #2
0
from flask_testing import TestCase, LiveServerTestCase
from groundstation import create_app, db
from selenium import webdriver
import urllib.request
from datetime import datetime, timedelta

from groundstation.backend_api.models import Housekeeping, PowerChannels, Telecommands
from groundstation.tests.utils import fakeHousekeepingAsDict, fake_power_channel_as_dict
from groundstation.backend_api.utils import add_telecommand, \
add_flight_schedule, add_command_to_flightschedule, add_user, \
add_arg_to_flightschedulecommand, add_message_to_communications, \
add_passover

app = create_app()


class BaseTestCase(TestCase):
    def create_app(self):
        app.config.from_object('groundstation.config.TestingConfig')
        return app

    def setUp(self):
        db.create_all()
        db.session.commit()

    def tearDown(self):
        db.session.remove()
        db.drop_all()


class BaseTestCaseFrontEnd(LiveServerTestCase):