def _set_up_app(self): self._ddb = mock_dynamodb2() self._ddb.start() from application import configure_logging configure_logging() setting_overrides = { 'SQLALCHEMY_DATABASE_URI': 'sqlite://', 'EQ_DYNAMODB_ENDPOINT': None } self._application = create_app(setting_overrides) self._key_store = KeyStore({ 'keys': { EQ_USER_AUTHENTICATION_RRM_PRIVATE_KEY_KID: { 'purpose': KEY_PURPOSE_AUTHENTICATION, 'type': 'private', 'value': get_file_contents( 'third-party/sdc-rrm-authentication-signing-private-v1.pem' ) }, SR_USER_AUTHENTICATION_PUBLIC_KEY_KID: { 'purpose': KEY_PURPOSE_AUTHENTICATION, 'type': 'public', 'value': get_file_contents( 'third-party/sdc-sr-authentication-encryption-public-v1.pem' ) }, EQ_SUBMISSION_SDX_PRIVATE_KEY: { 'purpose': KEY_PURPOSE_SUBMISSION, 'type': 'private', 'value': get_file_contents( 'third-party/sdc-sdx-submission-encryption-private-v1.pem' ) }, EQ_SUBMISSION_SR_PRIVATE_SIGNING_KEY: { 'purpose': KEY_PURPOSE_SUBMISSION, 'type': 'public', 'value': get_file_contents( 'sdc-sr-submission-signing-private-v1.pem') }, } }) self.token_generator = TokenGenerator( self._key_store, EQ_USER_AUTHENTICATION_RRM_PRIVATE_KEY_KID, SR_USER_AUTHENTICATION_PUBLIC_KEY_KID) self._client = self._application.test_client() with self._application.app_context(): setup_tables()
def _set_up_app(self): self._ds = patch("app.setup.datastore.Client", MockDatastore) self._ds.start() self._redis = patch("app.setup.redis.Redis", fakeredis.FakeStrictRedis) self._redis.start() from application import ( # pylint: disable=import-outside-toplevel configure_logging, ) configure_logging() setting_overrides = { "EQ_ENABLE_HTML_MINIFY": False, "EQ_SUBMISSION_CONFIRMATION_BACKEND": "log", } with patch( "google.auth._default._get_explicit_environ_credentials", return_value=(Mock(), "test-project-id"), ): self._application = create_app(setting_overrides) self._key_store = KeyStore({ "keys": { EQ_USER_AUTHENTICATION_RRM_PRIVATE_KEY_KID: { "purpose": KEY_PURPOSE_AUTHENTICATION, "type": "private", "value": get_file_contents( "sdc-rrm-authentication-signing-private-v1.pem"), }, SR_USER_AUTHENTICATION_PUBLIC_KEY_KID: { "purpose": KEY_PURPOSE_AUTHENTICATION, "type": "public", "value": get_file_contents( "sdc-sr-authentication-encryption-public-v1.pem"), }, EQ_SUBMISSION_SDX_PRIVATE_KEY: { "purpose": KEY_PURPOSE_SUBMISSION, "type": "private", "value": get_file_contents( "sdc-sdx-submission-encryption-private-v1.pem"), }, EQ_SUBMISSION_SR_PRIVATE_SIGNING_KEY: { "purpose": KEY_PURPOSE_SUBMISSION, "type": "public", "value": get_file_contents( "sdc-sr-submission-signing-private-v1.pem"), }, } }) self.token_generator = TokenGenerator( self._key_store, EQ_USER_AUTHENTICATION_RRM_PRIVATE_KEY_KID, SR_USER_AUTHENTICATION_PUBLIC_KEY_KID, ) self._client = self._application.test_client() self.session = self._client.session_transaction()