forked from datadesk/python-documentcloud
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathresults.txt
736 lines (634 loc) · 32.7 KB
/
results.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
rm -rf tests/cassettes/test_*/*
rm -rf tests/cassettes/fixtures/*
pytest --record-mode=all -m "not short"
============================= test session starts ==============================
platform linux -- Python 3.11.10, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/s/dev/python-documentcloud
configfile: pytest.ini
plugins: recording-0.13.2
collected 140 items / 2 deselected / 138 selected
tests/test_annotations.py ....... [ 5%]
tests/test_base.py .................... [ 19%]
tests/test_client.py FFEFFF.E.. [ 26%]
tests/test_documents.py ............................F.F................. [ 61%]
.....FFF....F.E..E....... [ 79%]
tests/test_organizarions.py . [ 80%]
tests/test_projects.py ........F.F...FFFF [ 93%]
tests/test_sections.py ... [ 95%]
tests/test_toolbox.py ..... [ 99%]
tests/test_users.py . [100%]
==================================== ERRORS ====================================
____________________ ERROR at setup of test_set_tokens_none ____________________
@pytest.fixture
def public_client():
> return DocumentCloud(
base_uri=BASE_URI, auth_uri=AUTH_URI, timeout=TIMEOUT, rate_limit=False
)
tests/conftest.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/client.py:34: in __init__
self.squarelet_client = SquareletClient(
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:49: in __init__
self._set_tokens()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b65599110>
def _set_tokens(self):
"""Set the refresh and access tokens"""
if self.refresh_token:
self.access_token, self.refresh_token = self._refresh_tokens(
self.refresh_token
)
elif self.username and self.password:
self.access_token, self.refresh_token = self._get_tokens(
self.username, self.password
)
elif self.access_token:
pass # Already have access token, do nothing
else:
> raise ValueError("No tokens found")
E ValueError: No tokens found
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:75: ValueError
____________________ ERROR at setup of test_user_id_public _____________________
@pytest.fixture
def public_client():
> return DocumentCloud(
base_uri=BASE_URI, auth_uri=AUTH_URI, timeout=TIMEOUT, rate_limit=False
)
tests/conftest.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/client.py:34: in __init__
self.squarelet_client = SquareletClient(
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:49: in __init__
self._set_tokens()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b655462d0>
def _set_tokens(self):
"""Set the refresh and access tokens"""
if self.refresh_token:
self.access_token, self.refresh_token = self._refresh_tokens(
self.refresh_token
)
elif self.username and self.password:
self.access_token, self.refresh_token = self._get_tokens(
self.username, self.password
)
elif self.access_token:
pass # Already have access token, do nothing
else:
> raise ValueError("No tokens found")
E ValueError: No tokens found
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:75: ValueError
___________ ERROR at setup of TestDocumentClient.test_public_upload ____________
@pytest.fixture
def public_client():
> return DocumentCloud(
base_uri=BASE_URI, auth_uri=AUTH_URI, timeout=TIMEOUT, rate_limit=False
)
tests/conftest.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/client.py:34: in __init__
self.squarelet_client = SquareletClient(
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:49: in __init__
self._set_tokens()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b6558dbd0>
def _set_tokens(self):
"""Set the refresh and access tokens"""
if self.refresh_token:
self.access_token, self.refresh_token = self._refresh_tokens(
self.refresh_token
)
elif self.username and self.password:
self.access_token, self.refresh_token = self._get_tokens(
self.username, self.password
)
elif self.access_token:
pass # Already have access token, do nothing
else:
> raise ValueError("No tokens found")
E ValueError: No tokens found
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:75: ValueError
__________ ERROR at setup of TestDocumentClient.test_upload_big_file ___________
file /home/s/dev/python-documentcloud/tests/test_documents.py, line 190
def test_upload_big_file(self, client, mocker):
E fixture 'mocker' not found
> available fixtures: allowed_hosts, block_network, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, client, default_cassette_name, disable_recording, doctest_namespace, document, document_factory, monkeypatch, project, project_factory, public_client, pytestconfig, rate_client, record_mode, record_property, record_testsuite_property, record_xml_attribute, recwarn, short_client, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory, vcr, vcr_cassette_dir, vcr_config, vcr_markers
> use 'pytest --fixtures [testpath]' for help on them.
/home/s/dev/python-documentcloud/tests/test_documents.py:190
=================================== FAILURES ===================================
_________________________ test_set_tokens_credentials __________________________
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_set_tokens_credentials(client):
"""Test setting the tokens using credentials"""
client.refresh_token = None
> del client.session.headers["Authorization"]
E AttributeError: 'DocumentCloud' object has no attribute 'session'
tests/test_client.py:21: AttributeError
___________________________ test_set_tokens_refresh ____________________________
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_set_tokens_refresh(client):
"""Test setting the tokens using refresh token"""
# first set tokens sets, refresh token, second one uses it
client.refresh_token = None
> del client.session.headers["Authorization"]
E AttributeError: 'DocumentCloud' object has no attribute 'session'
tests/test_client.py:31: AttributeError
_______________________________ test_get_tokens ________________________________
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_get_tokens(client):
"""Test getting access and refresh tokens using valid credentials"""
> access, refresh = client._get_tokens(client.username, client.password)
E AttributeError: 'DocumentCloud' object has no attribute '_get_tokens'
tests/test_client.py:47: AttributeError
_______________________ test_get_tokens_bad_credentials ________________________
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_get_tokens_bad_credentials(client):
"""Test getting access and refresh tokens using invalid credentials"""
with pytest.raises(CredentialsFailedError):
> client._get_tokens(client.username, "foo")
E AttributeError: 'DocumentCloud' object has no attribute '_get_tokens'
tests/test_client.py:55: AttributeError
_____________________________ test_refresh_tokens ______________________________
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_refresh_tokens(client):
"""Test refreshing the tokens"""
> access, refresh = client._refresh_tokens(client.refresh_token)
E AttributeError: 'DocumentCloud' object has no attribute '_refresh_tokens'
tests/test_client.py:60: AttributeError
____________________________ TestDocument.test_user ____________________________
self = <tests.test_documents.TestDocument object at 0x731b65651a90>
document = <Document: 20000018 - test>
def test_user(self, document):
assert document._user is None
> assert isinstance(document.user, User)
tests/test_documents.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Document: 20000018 - test>, attr = 'user'
def __getattr__(self, attr):
"""Generate methods for fetching resources"""
p_image = re.compile(
r"^get_(?P<size>thumbnail|small|normal|large)_image_url(?P<list>_list)?$"
)
get = attr.startswith("get_")
url = attr.endswith("_url")
text = attr.endswith("_text")
json = attr.endswith(("_json", "_json_text"))
fmt = "json" if json else "text" if text else None
# this allows dropping `get_` to act like a property, ie
# .full_text_url
if not get and hasattr(self, f"get_{attr}"):
return getattr(self, f"get_{attr}")()
# this allows dropping `_url` to fetch the url, ie
# .get_full_text()
if not url and hasattr(self, f"{attr}_url"):
return lambda *a, **k: self._get_url(
getattr(self, f"{attr}_url")(*a, **k), fmt
)
# this genericizes the image sizes
m_image = p_image.match(attr)
if m_image and m_image.group("list"):
return partial(self.get_image_url_list, size=m_image.group("size"))
if m_image and not m_image.group("list"):
return partial(self.get_image_url, size=m_image.group("size"))
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'Document' object has no attribute 'user'
documentcloud/documents.py:100: AttributeError
________________________ TestDocument.test_organization ________________________
self = <tests.test_documents.TestDocument object at 0x731b656525d0>
document = <Document: 20000018 - test>
def test_organization(self, document):
assert document._organization is None
> assert isinstance(document.organization, Organization)
tests/test_documents.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Document: 20000018 - test>, attr = 'organization'
def __getattr__(self, attr):
"""Generate methods for fetching resources"""
p_image = re.compile(
r"^get_(?P<size>thumbnail|small|normal|large)_image_url(?P<list>_list)?$"
)
get = attr.startswith("get_")
url = attr.endswith("_url")
text = attr.endswith("_text")
json = attr.endswith(("_json", "_json_text"))
fmt = "json" if json else "text" if text else None
# this allows dropping `get_` to act like a property, ie
# .full_text_url
if not get and hasattr(self, f"get_{attr}"):
return getattr(self, f"get_{attr}")()
# this allows dropping `_url` to fetch the url, ie
# .get_full_text()
if not url and hasattr(self, f"{attr}_url"):
return lambda *a, **k: self._get_url(
getattr(self, f"{attr}_url")(*a, **k), fmt
)
# this genericizes the image sizes
m_image = p_image.match(attr)
if m_image and m_image.group("list"):
return partial(self.get_image_url_list, size=m_image.group("size"))
if m_image and not m_image.group("list"):
return partial(self.get_image_url, size=m_image.group("size"))
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'Document' object has no attribute 'organization'
documentcloud/documents.py:100: AttributeError
_____________________ TestDocument.test_attrs[contributor] _____________________
self = <tests.test_documents.TestDocument object at 0x731b6566a110>
document = <Document: 20000018 - test>, attr = 'contributor'
@pytest.mark.parametrize(
"attr",
[
"id",
"access",
"asset_url",
"canonical_url",
"created_at",
"data",
"description",
"edit_access",
"language",
"organization_id",
"page_count",
"page_spec",
"projects",
"related_article",
"published_url",
"slug",
"source",
"status",
"title",
"updated_at",
"user_id",
"pages",
"contributor",
"contributor_organization",
"contributor_organization_slug",
],
)
def test_attrs(self, document, attr):
> assert getattr(document, attr)
tests/test_documents.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Document: 20000018 - test>, attr = 'contributor'
def __getattr__(self, attr):
"""Generate methods for fetching resources"""
p_image = re.compile(
r"^get_(?P<size>thumbnail|small|normal|large)_image_url(?P<list>_list)?$"
)
get = attr.startswith("get_")
url = attr.endswith("_url")
text = attr.endswith("_text")
json = attr.endswith(("_json", "_json_text"))
fmt = "json" if json else "text" if text else None
# this allows dropping `get_` to act like a property, ie
# .full_text_url
if not get and hasattr(self, f"get_{attr}"):
return getattr(self, f"get_{attr}")()
# this allows dropping `_url` to fetch the url, ie
# .get_full_text()
if not url and hasattr(self, f"{attr}_url"):
return lambda *a, **k: self._get_url(
getattr(self, f"{attr}_url")(*a, **k), fmt
)
# this genericizes the image sizes
m_image = p_image.match(attr)
if m_image and m_image.group("list"):
return partial(self.get_image_url_list, size=m_image.group("size"))
if m_image and not m_image.group("list"):
return partial(self.get_image_url, size=m_image.group("size"))
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'Document' object has no attribute 'contributor'
documentcloud/documents.py:100: AttributeError
______________ TestDocument.test_attrs[contributor_organization] _______________
self = <tests.test_documents.TestDocument object at 0x731b6566a410>
document = <Document: 20000018 - test>, attr = 'contributor_organization'
@pytest.mark.parametrize(
"attr",
[
"id",
"access",
"asset_url",
"canonical_url",
"created_at",
"data",
"description",
"edit_access",
"language",
"organization_id",
"page_count",
"page_spec",
"projects",
"related_article",
"published_url",
"slug",
"source",
"status",
"title",
"updated_at",
"user_id",
"pages",
"contributor",
"contributor_organization",
"contributor_organization_slug",
],
)
def test_attrs(self, document, attr):
> assert getattr(document, attr)
tests/test_documents.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Document: 20000018 - test>, attr = 'contributor_organization'
def __getattr__(self, attr):
"""Generate methods for fetching resources"""
p_image = re.compile(
r"^get_(?P<size>thumbnail|small|normal|large)_image_url(?P<list>_list)?$"
)
get = attr.startswith("get_")
url = attr.endswith("_url")
text = attr.endswith("_text")
json = attr.endswith(("_json", "_json_text"))
fmt = "json" if json else "text" if text else None
# this allows dropping `get_` to act like a property, ie
# .full_text_url
if not get and hasattr(self, f"get_{attr}"):
return getattr(self, f"get_{attr}")()
# this allows dropping `_url` to fetch the url, ie
# .get_full_text()
if not url and hasattr(self, f"{attr}_url"):
return lambda *a, **k: self._get_url(
getattr(self, f"{attr}_url")(*a, **k), fmt
)
# this genericizes the image sizes
m_image = p_image.match(attr)
if m_image and m_image.group("list"):
return partial(self.get_image_url_list, size=m_image.group("size"))
if m_image and not m_image.group("list"):
return partial(self.get_image_url, size=m_image.group("size"))
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'Document' object has no attribute 'contributor_organization'
documentcloud/documents.py:100: AttributeError
____________ TestDocument.test_attrs[contributor_organization_slug] ____________
self = <tests.test_documents.TestDocument object at 0x731b656517d0>
document = <Document: 20000018 - test>, attr = 'contributor_organization_slug'
@pytest.mark.parametrize(
"attr",
[
"id",
"access",
"asset_url",
"canonical_url",
"created_at",
"data",
"description",
"edit_access",
"language",
"organization_id",
"page_count",
"page_spec",
"projects",
"related_article",
"published_url",
"slug",
"source",
"status",
"title",
"updated_at",
"user_id",
"pages",
"contributor",
"contributor_organization",
"contributor_organization_slug",
],
)
def test_attrs(self, document, attr):
> assert getattr(document, attr)
tests/test_documents.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Document: 20000018 - test>, attr = 'contributor_organization_slug'
def __getattr__(self, attr):
"""Generate methods for fetching resources"""
p_image = re.compile(
r"^get_(?P<size>thumbnail|small|normal|large)_image_url(?P<list>_list)?$"
)
get = attr.startswith("get_")
url = attr.endswith("_url")
text = attr.endswith("_text")
json = attr.endswith(("_json", "_json_text"))
fmt = "json" if json else "text" if text else None
# this allows dropping `get_` to act like a property, ie
# .full_text_url
if not get and hasattr(self, f"get_{attr}"):
return getattr(self, f"get_{attr}")()
# this allows dropping `_url` to fetch the url, ie
# .get_full_text()
if not url and hasattr(self, f"{attr}_url"):
return lambda *a, **k: self._get_url(
getattr(self, f"{attr}_url")(*a, **k), fmt
)
# this genericizes the image sizes
m_image = p_image.match(attr)
if m_image and m_image.group("list"):
return partial(self.get_image_url_list, size=m_image.group("size"))
if m_image and not m_image.group("list"):
return partial(self.get_image_url, size=m_image.group("size"))
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'Document' object has no attribute 'contributor_organization_slug'
documentcloud/documents.py:100: AttributeError
_________________________ TestDocumentClient.test_list _________________________
self = <tests.test_documents.TestDocumentClient object at 0x731b65678350>
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_list(self, client):
# list and all are aliases
all_documents = client.documents.all()
my_documents = client.documents.list(user=client.user_id)
> assert len(list(all_documents)) > len(list(my_documents.results))
E assert 8 > 8
E + where 8 = len([<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 20000018 - test>, <Document: 20000019 - test>, <Document: 20000020 - test>, ...])
E + where [<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 20000018 - test>, <Document: 20000019 - test>, <Document: 20000020 - test>, ...] = list(<APIResults: [<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 200000...>, <Document: 20000019 - test>, <Document: 20000020 - test>, <Document: 20000021 - test>, <Document: 20000023 - test>]>)
E + and 8 = len([<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 20000018 - test>, <Document: 20000019 - test>, <Document: 20000020 - test>, ...])
E + where [<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 20000018 - test>, <Document: 20000019 - test>, <Document: 20000020 - test>, ...] = list([<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 20000018 - test>, <Document: 20000019 - test>, <Document: 20000020 - test>, ...])
E + where [<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 20000018 - test>, <Document: 20000019 - test>, <Document: 20000020 - test>, ...] = <APIResults: [<Document: 20000010 - test>, <Document: 20000011 - text>, <Document: 20000017 - test>, <Document: 200000...>, <Document: 20000019 - test>, <Document: 20000020 - test>, <Document: 20000021 - test>, <Document: 20000023 - test>]>.results
tests/test_documents.py:170: AssertionError
_________________________ TestProjectClient.test_list __________________________
self = <tests.test_projects.TestProjectClient object at 0x731b65695510>
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_list(self, client):
all_projects = client.projects.list()
> my_projects = client.projects.all()
tests/test_projects.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/projects.py:100: in all
return self.list(user=self.client.user_id, **params)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b66621f90>
attr = 'user_id'
def __getattr__(self, attr):
"""Generate methods for each HTTP request type (GET, POST, etc.)"""
methods = ["get", "post", "put", "delete", "patch", "head", "options"]
if attr in methods:
return partial(self.request, attr)
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'SquareletClient' object has no attribute 'user_id'
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:180: AttributeError
_______________________ TestProjectClient.test_get_title _______________________
self = <tests.test_projects.TestProjectClient object at 0x731b65696190>
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
project = <Project: 200006 - This is a project for testing cbf2dcc0-58ba-4f12-9b11-d43545458088>
def test_get_title(self, client, project):
> assert client.projects.get(title=project.title)
tests/test_projects.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/projects.py:115: in get
return self.get_by_title(title)
documentcloud/projects.py:122: in get_by_title
f"{self.api_path}/", params={"title": title, "user": self.client.user_id}
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b66621f90>
attr = 'user_id'
def __getattr__(self, attr):
"""Generate methods for each HTTP request type (GET, POST, etc.)"""
methods = ["get", "post", "put", "delete", "patch", "head", "options"]
if attr in methods:
return partial(self.request, attr)
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'SquareletClient' object has no attribute 'user_id'
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:180: AttributeError
_____________________ TestProjectClient.test_get_by_title ______________________
self = <tests.test_projects.TestProjectClient object at 0x731b65696d90>
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
project = <Project: 200006 - This is a project for testing cbf2dcc0-58ba-4f12-9b11-d43545458088>
def test_get_by_title(self, client, project):
> assert client.projects.get_by_title(project.title)
tests/test_projects.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/projects.py:122: in get_by_title
f"{self.api_path}/", params={"title": title, "user": self.client.user_id}
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b66621f90>
attr = 'user_id'
def __getattr__(self, attr):
"""Generate methods for each HTTP request type (GET, POST, etc.)"""
methods = ["get", "post", "put", "delete", "patch", "head", "options"]
if attr in methods:
return partial(self.request, attr)
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'SquareletClient' object has no attribute 'user_id'
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:180: AttributeError
_________________ TestProjectClient.test_get_by_title_multiple _________________
self = <tests.test_projects.TestProjectClient object at 0x731b65697110>
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
project_factory = <function project_factory.<locals>.make_project at 0x731b656465c0>
def test_get_by_title_multiple(self, client, project_factory):
for _ in range(2):
project_factory(title="Dupe")
with pytest.raises(MultipleObjectsReturnedError):
> client.projects.get_by_title("Dupe")
tests/test_projects.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/projects.py:122: in get_by_title
f"{self.api_path}/", params={"title": title, "user": self.client.user_id}
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b66621f90>
attr = 'user_id'
def __getattr__(self, attr):
"""Generate methods for each HTTP request type (GET, POST, etc.)"""
methods = ["get", "post", "put", "delete", "patch", "head", "options"]
if attr in methods:
return partial(self.request, attr)
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'SquareletClient' object has no attribute 'user_id'
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:180: AttributeError
______________ TestProjectClient.test_get_or_create_by_title_get _______________
self = <tests.test_projects.TestProjectClient object at 0x731b65697490>
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
project = <Project: 200006 - This is a project for testing cbf2dcc0-58ba-4f12-9b11-d43545458088>
def test_get_or_create_by_title_get(self, client, project):
title = project.title
> project, created = client.projects.get_or_create_by_title(title)
tests/test_projects.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/projects.py:146: in get_or_create_by_title
project = self.get(title=title)
documentcloud/projects.py:115: in get
return self.get_by_title(title)
documentcloud/projects.py:122: in get_by_title
f"{self.api_path}/", params={"title": title, "user": self.client.user_id}
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b66621f90>
attr = 'user_id'
def __getattr__(self, attr):
"""Generate methods for each HTTP request type (GET, POST, etc.)"""
methods = ["get", "post", "put", "delete", "patch", "head", "options"]
if attr in methods:
return partial(self.request, attr)
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'SquareletClient' object has no attribute 'user_id'
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:180: AttributeError
_____________ TestProjectClient.test_get_or_create_by_title_create _____________
self = <tests.test_projects.TestProjectClient object at 0x731b656977d0>
client = <documentcloud.client.DocumentCloud object at 0x731b65791c90>
def test_get_or_create_by_title_create(self, client):
title = "Created Title"
> project, created = client.projects.get_or_create_by_title(title)
tests/test_projects.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
documentcloud/projects.py:146: in get_or_create_by_title
project = self.get(title=title)
documentcloud/projects.py:115: in get
return self.get_by_title(title)
documentcloud/projects.py:122: in get_by_title
f"{self.api_path}/", params={"title": title, "user": self.client.user_id}
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <squarelet.squarelet.SquareletClient object at 0x731b66621f90>
attr = 'user_id'
def __getattr__(self, attr):
"""Generate methods for each HTTP request type (GET, POST, etc.)"""
methods = ["get", "post", "put", "delete", "patch", "head", "options"]
if attr in methods:
return partial(self.request, attr)
> raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{attr}'"
)
E AttributeError: 'SquareletClient' object has no attribute 'user_id'
../../.local/lib/python3.11/site-packages/squarelet/squarelet.py:180: AttributeError
=========================== short test summary info ============================
FAILED tests/test_client.py::test_set_tokens_credentials - AttributeError: 'D...
FAILED tests/test_client.py::test_set_tokens_refresh - AttributeError: 'Docum...
FAILED tests/test_client.py::test_get_tokens - AttributeError: 'DocumentCloud...
FAILED tests/test_client.py::test_get_tokens_bad_credentials - AttributeError...
FAILED tests/test_client.py::test_refresh_tokens - AttributeError: 'DocumentC...
FAILED tests/test_documents.py::TestDocument::test_user - AttributeError: 'Do...
FAILED tests/test_documents.py::TestDocument::test_organization - AttributeEr...
FAILED tests/test_documents.py::TestDocument::test_attrs[contributor] - Attri...
FAILED tests/test_documents.py::TestDocument::test_attrs[contributor_organization]
FAILED tests/test_documents.py::TestDocument::test_attrs[contributor_organization_slug]
FAILED tests/test_documents.py::TestDocumentClient::test_list - assert 8 > 8
FAILED tests/test_projects.py::TestProjectClient::test_list - AttributeError:...
FAILED tests/test_projects.py::TestProjectClient::test_get_title - AttributeE...
FAILED tests/test_projects.py::TestProjectClient::test_get_by_title - Attribu...
FAILED tests/test_projects.py::TestProjectClient::test_get_by_title_multiple
FAILED tests/test_projects.py::TestProjectClient::test_get_or_create_by_title_get
FAILED tests/test_projects.py::TestProjectClient::test_get_or_create_by_title_create
ERROR tests/test_client.py::test_set_tokens_none - ValueError: No tokens found
ERROR tests/test_client.py::test_user_id_public - ValueError: No tokens found
ERROR tests/test_documents.py::TestDocumentClient::test_public_upload - Value...
ERROR tests/test_documents.py::TestDocumentClient::test_upload_big_file
====== 17 failed, 117 passed, 2 deselected, 4 errors in 122.59s (0:02:02) ======