Created
August 20, 2018 18:15
-
-
Save mcdonc/7be3eeff292397b387db5143e1ffa0f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_____________________________ test_watch_document ______________________________ | |
client = <google.cloud.firestore_v1beta1.client.Client object at 0x7f5b1b24ca90> | |
cleanup = <built-in method append of list object at 0x7f5b18983d88> | |
def test_watch_document(client, cleanup): | |
db = client | |
doc_ref = db.collection(u'users').document( | |
u'alovelace' + unique_resource_id()) | |
# Initial setting | |
doc_ref.set({ | |
u'first': u'Jane', | |
u'last': u'Doe', | |
u'born': 1900 | |
}) | |
sleep(1) | |
# Setup listener | |
def on_response(response): | |
on_response.called_count += 1 | |
print(f'Response: {response}') | |
print(type(response)) | |
on_response.called_count = 0 | |
doc_ref.on_snapshot(on_response) | |
# Alter document | |
doc_ref.set({ | |
u'first': u'Ada', | |
u'last': u'Lovelace', | |
u'born': 1815 | |
}) | |
sleep(1) | |
if on_response.called_count != 1: | |
> raise AssertionError("Failed to get exactly one document change") | |
E AssertionError: Failed to get exactly one document change | |
tests/system.py:784: AssertionError | |
----------------------------- Captured stdout call ----------------------------- | |
request generator created | |
------------------------------ Captured log call ------------------------------- | |
bidi.py 506 ERROR Thread-ConsumeBidirectionalStream caught unexpected exception on_response() takes 1 positional argument but 3 were given and will exit. | |
Traceback (most recent call last): | |
File "/home/chrism/projects/gcloud/google-cloud-python-crwilcox/firestore/.nox/sys-3-6/lib/python3.6/site-packages/google/cloud/firestore_v1beta1/bidi.py", line 494, in _thread_main | |
self._on_response(response) | |
File "/home/chrism/projects/gcloud/google-cloud-python-crwilcox/firestore/.nox/sys-3-6/lib/python3.6/site-packages/google/cloud/firestore_v1beta1/watch.py", line 392, in on_snapshot | |
self.push(change.read_time, change.resume_token) | |
File "/home/chrism/projects/gcloud/google-cloud-python-crwilcox/firestore/.nox/sys-3-6/lib/python3.6/site-packages/google/cloud/firestore_v1beta1/watch.py", line 539, in push | |
datetime.datetime.fromtimestamp(read_time.seconds) | |
TypeError: on_response() takes 1 positional argument but 3 were given |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment