def _instrument_iid_service(self, app=None, status=200, payload=_DEFAULT_RESPONSE): if not app: app = firebase_admin.get_app() fcm_service = messaging._get_messaging_service(app) recorder = [] fcm_service._client.session.mount( 'https://iid.googleapis.com', testutils.MockAdapter(payload, status, recorder)) return fcm_service, recorder
def _instrument_messaging_service(self, app, status=200, payload=_DEFAULT_RESPONSE): fcm_service = messaging._get_messaging_service(app) recorder = [] fcm_service._client.session.mount( 'https://fcm.googleapis.com', MockAdapter(payload, status, recorder)) return fcm_service, recorder
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_app_identity_stub() self.testbed.init_memcache_stub() self.testbed.setup_env(app_id='your-app-id', overwrite=True) # Stub the FCM admin module try: self._app = firebase_admin.get_app('tbans') except ValueError: self._app = firebase_admin.initialize_app(name='tbans') messaging._get_messaging_service(self._app).send = self._stub_send
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_app_identity_stub() self.testbed.init_memcache_stub() self.testbed.setup_env(app_id='your-app-id', overwrite=True) # Stub the FCM admin module try: self._app = firebase_admin.get_app('tbans') except ValueError: self._app = firebase_admin.initialize_app(name='tbans') messaging._get_messaging_service(self._app).send = self._stub_send
def setup(self): app = firebase_admin.get_app() self.fcm_service = messaging._get_messaging_service(app) self.recorder = []