def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()
        self.testbed.init_urlfetch_stub()
        # Create the mocked service & inject it into the testbed
        self.fetch_mock = UrlFetchMock()
        self.testbed._register_stub(testbed.URLFETCH_SERVICE_NAME, self.fetch_mock)

        self.app = main.get_app()
        # Define the endpoint for all our requests
        self.endpoint = "/scores"
        # Define the base request
        self.request = webapp2.Request.blank(self.endpoint)
        # Timestamp in seconds
        self.timestamp = int(datetime.datetime.now().strftime('%s'))
        # An arbitrary and unrealistic week number
        self.week = (self.timestamp % 1000) + 500
        # Content for GET requests
        self.content_str = (
            '{"ss":[["Sat","4:30","final overtime",0,"BAL",'
            '"38","DEN","35",0,0,"55829",0,"REG11","2012"'
            ']]}').encode("UTF-8")
        # Data for GET requests
        self.data = {
            "content": self.content_str,
            "final_url": (sb.URL_REG).encode("UTF-8"),
            "status_code": 200
        }
        self.fetch_mock.set_return_values(**self.data)
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()

        self.app = main.get_app()
        self.endpoint = "/spreads"
        self.request = webapp2.Request.blank(self.endpoint)

        self.data_factory = DataBlobFactory()
        test_data = TestDataFactory()
        self.week = test_data.get_instance(data_type="week")
        self.timestamp = test_data.get_instance(data_type='timestamp')
Esempio n. 3
0
from main import get_app

app = get_app()

if __name__ == "__main__":
    app.run()
Esempio n. 4
0
 async def get_application(self):
     return get_app()
Esempio n. 5
0
from logging.config import fileConfig

from sqlalchemy import engine_from_config
from sqlalchemy import pool
import os
import sys

from alembic import context
from config import DB_DSN, DB_RETRY_LIMIT, DB_RETRY_INTERVAL
from main import get_app, db

sys.path.append(os.path.dirname(os.path.dirname(__file__)))

get_app()
target_metadata = db

config = context.config

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
Esempio n. 6
0
def client():
    with TestClient(get_app()) as tc:
        yield tc
Esempio n. 7
0
 def get_app(self, motor_client_mock):
     return get_app()
Esempio n. 8
0
 def get_app(self, motor_client_mock):
     return get_app()
Esempio n. 9
0
def runserver():
    uvicorn.run(get_app())
Esempio n. 10
0
 def get_app(self):
     return main.get_app()