def setUp(self): """setup test environment""" self.app = create_app() self.client = self.app.test_client() self.app.testing = True with self.app.app_context(): database.db.init_app(current_app) database.db.drop_all() database.db.create_all() self.db = database.db
def setUp(self): """setup test environment""" self.app = application.create_app() self.client = self.app.test_client() self.engine = create_engine(self.app.config['SQLALCHEMY_DATABASE_URI']) self.oauth_client_token = { "access_token": "705288eea2474641bde364032d465157", "token_type": "bearer", "expires_in": 43199, "scope": "clients.read emails.write scim.userids password.write idps.write notifications.write oauth.login scim.write critical_notifications.write", "jti": "705288eea2474641bde364032d465157" }
def setUp(self): """setup test environment""" app = create_app() app.testing = True self.engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI']) self.test_message = Message(**{'msg_to': 'tej', 'msg_from': 'gemma', 'subject': 'MyMessage', 'body': 'hello', 'thread_id': ""}) with app.app_context(): database.db.init_app(current_app) database.db.drop_all() database.db.create_all() self.db = database.db self.app = app
def setUp(self): """setup test environment""" self.json_message = { 'msg_to': ['Tej'], 'msg_from': 'Gemma', 'subject': 'MyMessage', 'body': 'hello', 'thread_id': "", 'business_id': "7fc0e8ab-189c-4794-b8f4-9f05a1db185b", 'survey': "RSI" } self.now = datetime.now(timezone.utc) internal_user_service.use_mock_service() party.use_mock_service() self.app = create_app()
def setUp(self): """setup test environment""" self.app = create_app() self.app.testing = True self.engine = create_engine(self.app.config['SQLALCHEMY_DATABASE_URI']) with self.app.app_context(): database.db.init_app(current_app) database.db.drop_all() database.db.create_all() self.db = database.db self.user_internal = User('ce12b958-2a5f-44f4-a6da-861e59070a31', 'internal') self.user_respondent = User('0a7ad740-10d5-4ecb-b7ca-3c0384afb882', 'respondent')
def setUp(self): """setup test environment""" self.app = application.create_app() self.client = self.app.test_client() self.engine = create_engine(self.app.config['SQLALCHEMY_DATABASE_URI']) internal_token_data = {constants.USER_IDENTIFIER: AppTestCase.SPECIFIC_INTERNAL_USER, "role": "internal"} external_token_data = {constants.USER_IDENTIFIER: AppTestCase.SPECIFIC_EXTERNAL_USER, "role": "respondent", "claims": [{'business_id': 'f1a5e99c-8edf-489a-9c72-6cabe6c387fc', 'surveys': [AppTestCase.BRES_SURVEY] }] } with self.app.app_context(): internal_signed_jwt = encode(internal_token_data) external_signed_jwt = encode(external_token_data) self.internal_user_header = {'Content-Type': 'application/json', 'Authorization': internal_signed_jwt} self.external_user_header = {'Content-Type': 'application/json', 'Authorization': external_signed_jwt} self.test_message = {'msg_to': ['0a7ad740-10d5-4ecb-b7ca-3c0384afb882'], 'msg_from': AppTestCase.SPECIFIC_INTERNAL_USER, 'subject': 'MyMessage', 'body': 'hello', 'thread_id': "", 'collection_case': 'ACollectionCase', 'collection_exercise': 'ACollectionExercise', 'business_id': 'f1a5e99c-8edf-489a-9c72-6cabe6c387fc', 'survey': self.BRES_SURVEY} with self.app.app_context(): database.db.init_app(current_app) database.db.drop_all() database.db.create_all() self.db = database.db party.use_mock_service() internal_user_service.use_mock_service()
def setUp(self): """setup test environment""" self.app = create_app() self.app.testing = True self.engine = create_engine(self.app.config['SQLALCHEMY_DATABASE_URI']) self.MESSAGE_LIST_ENDPOINT = "http://localhost:5050/messages" self.MESSAGE_BY_ID_ENDPOINT = "http://localhost:5050/message/" with self.app.app_context(): database.db.init_app(current_app) database.db.drop_all() database.db.create_all() self.db = database.db self.user_internal = User( RetrieverTestCaseHelper.default_internal_actor, 'internal') self.second_user_internal = User( RetrieverTestCaseHelper.second_internal_actor, 'internal') self.user_respondent = User( RetrieverTestCaseHelper.default_external_actor, 'respondent') self.second_user_respondent = User( RetrieverTestCaseHelper.second_external_actor, 'respondent') party.use_mock_service()
from secure_message.application import create_app # This is a duplicate of run.py, with minor modifications to support gunicorn execution. app = create_app()
def setUp(self): """setup test environment""" self.app = create_app()
def setUp(self): """setup test environment""" self.app = create_app() self.app.testing = True party.use_mock_service() internal_user_service.use_mock_service()
def setUp(self): self.app = create_app() self.client = self.app.test_client() internal_user_service.use_mock_service() party.use_mock_service()
def setUp(self): """creates a test client""" self.app = create_app()
def before_all(context): context.app = create_app(config='TestConfig') with context.app.app_context(): context.client = current_app.test_client()