def test_listener_session(self): firebase_admin.initialize_app( testutils.MockCredential(), { 'databaseURL': 'https://test.firebaseio.com', }) try: ref = db.reference() session = ref._client.create_listener_session() assert isinstance(session, _sseclient.KeepAuthSession) finally: testutils.cleanup_apps()
def test_listen_error(self): test_url = 'https://test.firebaseio.com' firebase_admin.initialize_app(testutils.MockCredential(), { 'databaseURL' : test_url, }) try: ref = db.reference() adapter = MockAdapter(json.dumps({'error' : 'json error message'}), 500, []) session = ref._client.session session.mount(test_url, adapter) def callback(_): pass with pytest.raises(db.ApiCallError) as excinfo: ref._listen_with_session(callback, session) assert 'Reason: json error message' in str(excinfo.value) finally: testutils.cleanup_apps()
def teardown_module(): testutils.cleanup_apps()
def teardown_method(self): testutils.cleanup_apps()
def teardown_class(cls): testutils.cleanup_apps()
def teardown_method(self, method): del method testutils.cleanup_apps()
def teardown(self): testutils.cleanup_apps()
def teardown_function(): testutils.cleanup_apps()