-
Notifications
You must be signed in to change notification settings - Fork 696
/
Copy pathtest_integration.py
691 lines (594 loc) · 25.4 KB
/
test_integration.py
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
import gzip
import os
import random
import re
import zipfile
from io import BytesIO
from unittest import mock
import journalist_app as journalist_app_module
from bs4 import BeautifulSoup
from db import db
from encryption import EncryptionManager
from flask import escape
from journalist_app.sessions import session
from source_app.session_manager import SessionManager
from store import Storage
from tests import utils
from tests.utils import login_journalist
from two_factor import TOTP
# Seed the RNG for deterministic testing
random.seed("ಠ_ಠ")
GENERATE_DATA = {"tor2web_check": 'href="fake.onion"'}
def test_submit_message(journalist_app, source_app, test_journo, app_storage):
"""When a source creates an account, test that a new entry appears
in the journalist interface"""
test_msg = "This is a test message."
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
app.post("/create", data={"tab_id": tab_id}, follow_redirects=True)
source_user = SessionManager.get_logged_in_user(db_session=db.session)
filesystem_id = source_user.filesystem_id
# redirected to submission form
resp = app.post(
"/submit",
data=dict(
msg=test_msg,
fh=(BytesIO(b""), ""),
),
follow_redirects=True,
)
assert resp.status_code == 200
app.get("/logout")
# Request the Journalist Interface index
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
resp = app.get("/")
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "Sources" in text
soup = BeautifulSoup(text, "html.parser")
# The source should have a "download unread" link that
# says "1 unread"
col = soup.select("table#collections tr.source")[0]
unread_span = col.select("td.unread a")[0]
assert "1 unread" in unread_span.get_text()
col_url = soup.select("table#collections th.designation a")[0]["href"]
resp = app.get(col_url)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
soup = BeautifulSoup(text, "html.parser")
submission_url = soup.select("table#submissions th.filename a")[0]["href"]
assert "-msg" in submission_url
size = soup.select("table#submissions td.info")[0]
assert re.compile(r"\d+ bytes").match(size["title"])
resp = app.get(submission_url)
assert resp.status_code == 200
decryption_result = utils.decrypt_as_journalist(resp.data).decode()
assert decryption_result == test_msg
# delete submission
resp = app.get(col_url)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
soup = BeautifulSoup(text, "html.parser")
doc_name = soup.select(
'table#submissions > tr.submission > td.status input[name="doc_names_selected"]'
)[0]["value"]
resp = app.post(
"/bulk",
data=dict(
action="delete",
filesystem_id=filesystem_id,
doc_names_selected=doc_name,
),
follow_redirects=True,
)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
soup = BeautifulSoup(text, "html.parser")
assert "The item has been deleted." in text
# confirm that submission deleted and absent in list of submissions
resp = app.get(col_url)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "No submissions to display." in text
# the file should be deleted from the filesystem
# since file deletion is handled by a polling worker, this test
# needs to wait for the worker to get the job and execute it
def assertion():
assert not (os.path.exists(app_storage.path(filesystem_id, doc_name)))
utils.asynchronous.wait_for_assertion(assertion)
def test_submit_file(journalist_app, source_app, test_journo, app_storage):
"""When a source creates an account, test that a new entry appears
in the journalist interface"""
test_file_contents = b"This is a test file."
test_filename = "test.txt"
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
app.post("/create", data={"tab_id": tab_id}, follow_redirects=True)
source_user = SessionManager.get_logged_in_user(db_session=db.session)
filesystem_id = source_user.filesystem_id
# redirected to submission form
resp = app.post(
"/submit",
data=dict(
msg="",
fh=(BytesIO(test_file_contents), test_filename),
),
follow_redirects=True,
)
assert resp.status_code == 200
app.get("/logout")
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
resp = app.get("/")
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "Sources" in text
soup = BeautifulSoup(text, "html.parser")
# The source should have a "download unread" link that says
# "1 unread"
col = soup.select("table#collections tr.source")[0]
unread_span = col.select("td.unread a")[0]
assert "1 unread" in unread_span.get_text()
col_url = soup.select("table#collections th.designation a")[0]["href"]
resp = app.get(col_url)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
soup = BeautifulSoup(text, "html.parser")
submission_url = soup.select("table#submissions th.filename a")[0]["href"]
assert "-doc" in submission_url
size = soup.select("table#submissions td.info")[0]
assert re.compile(r"\d+ bytes").match(size["title"])
resp = app.get(submission_url)
assert resp.status_code == 200
decrypted_data = utils.decrypt_as_journalist(resp.data)
sio = BytesIO(decrypted_data)
with gzip.GzipFile(mode="rb", fileobj=sio) as gzip_file:
unzipped_decrypted_data = gzip_file.read()
mtime = gzip_file.mtime
assert unzipped_decrypted_data == test_file_contents
# Verify gzip file metadata and ensure timestamp is not present.
assert mtime == 0
# delete submission
resp = app.get(col_url)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
soup = BeautifulSoup(text, "html.parser")
doc_name = soup.select(
'table#submissions > tr.submission > td.status input[name="doc_names_selected"]'
)[0]["value"]
resp = app.post(
"/bulk",
data=dict(
action="delete",
filesystem_id=filesystem_id,
doc_names_selected=doc_name,
),
follow_redirects=True,
)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "The item has been deleted." in text
soup = BeautifulSoup(resp.data, "html.parser")
# confirm that submission deleted and absent in list of submissions
resp = app.get(col_url)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "No submissions to display." in text
# the file should be deleted from the filesystem
# since file deletion is handled by a polling worker, this test
# needs to wait for the worker to get the job and execute it
def assertion():
assert not (os.path.exists(app_storage.path(filesystem_id, doc_name)))
utils.asynchronous.wait_for_assertion(assertion)
def _helper_test_reply(journalist_app, source_app, test_journo, test_reply):
test_msg = "This is a test message."
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id, codename = next(iter(session["codenames"].items()))
app.post("/create", data={"tab_id": tab_id}, follow_redirects=True)
# redirected to submission form
resp = app.post(
"/submit",
data=dict(
msg=test_msg,
fh=(BytesIO(b""), ""),
),
follow_redirects=True,
)
assert resp.status_code == 200
source_user = SessionManager.get_logged_in_user(db_session=db.session)
filesystem_id = source_user.filesystem_id
app.get("/logout")
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
resp = app.get("/")
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "Sources" in text
soup = BeautifulSoup(resp.data, "html.parser")
col_url = soup.select("table#collections tr.source > th.designation a")[0]["href"]
resp = app.get(col_url)
assert resp.status_code == 200
# Create 2 replies to test deleting on journalist and source interface
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
for i in range(2):
resp = app.post(
"/reply",
data=dict(filesystem_id=filesystem_id, message=test_reply),
follow_redirects=True,
)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "The source will receive your reply" in text
resp = app.get(col_url)
text = resp.data.decode("utf-8")
assert "reply-" in text
soup = BeautifulSoup(text, "html.parser")
# Download the reply and verify that it can be decrypted with the
# journalist's key as well as the source's reply key
filesystem_id = soup.select('input[name="filesystem_id"]')[0]["value"]
checkbox_values = [soup.select('input[name="doc_names_selected"]')[1]["value"]]
resp = app.post(
"/bulk",
data=dict(
filesystem_id=filesystem_id,
action="download",
doc_names_selected=checkbox_values,
),
follow_redirects=True,
)
assert resp.status_code == 200
zf = zipfile.ZipFile(BytesIO(resp.data), "r")
data = zf.read(zf.namelist()[0])
journalist_decrypted = utils.decrypt_as_journalist(data).decode()
assert journalist_decrypted == test_reply
source_decrypted = EncryptionManager.get_default().decrypt_journalist_reply(source_user, data)
assert source_decrypted == test_reply
# Test deleting reply on the journalist interface
last_reply_number = len(soup.select('input[name="doc_names_selected"]')) - 1
_helper_filenames_delete(app, soup, last_reply_number)
with source_app.test_client() as app:
resp = app.post("/login", data=dict(codename=codename), follow_redirects=True)
assert resp.status_code == 200
resp = app.get("/lookup")
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "You have received a reply. To protect your identity" in text
assert test_reply in text, text
soup = BeautifulSoup(text, "html.parser")
msgid = soup.select('form > input[name="reply_filename"]')[0]["value"]
resp = app.post(
"/delete",
data=dict(filesystem_id=filesystem_id, reply_filename=msgid),
follow_redirects=True,
)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert "Reply deleted" in text
app.get("/logout")
def _helper_filenames_delete(journalist_app, soup, i):
filesystem_id = soup.select('input[name="filesystem_id"]')[0]["value"]
checkbox_values = [soup.select('input[name="doc_names_selected"]')[i]["value"]]
# delete
resp = journalist_app.post(
"/bulk",
data=dict(
filesystem_id=filesystem_id,
action="delete",
doc_names_selected=checkbox_values,
),
follow_redirects=True,
)
assert resp.status_code == 200
assert "The item has been deleted." in resp.data.decode("utf-8")
# Make sure the files were deleted from the filesystem
def assertion():
assert not any(
[
os.path.exists(Storage.get_default().path(filesystem_id, doc_name))
for doc_name in checkbox_values
]
)
utils.asynchronous.wait_for_assertion(assertion)
def test_reply_normal(journalist_app, source_app, test_journo):
"""Test for regression on #1360 (failure to encode bytes before calling
gpg functions).
"""
encryption_mgr = EncryptionManager.get_default()
encryption_mgr.gpg() # lazily initialize GPG
with mock.patch.object(encryption_mgr._gpg, "_encoding", "ansi_x3.4_1968"):
_helper_test_reply(
journalist_app,
source_app,
test_journo,
"This is a test reply.",
)
def test_unicode_reply_with_ansi_env(journalist_app, source_app, test_journo):
# This makes python-gnupg handle encoding equivalent to if we were
# running SD in an environment where os.getenv("LANG") == "C".
# Unfortunately, with the way our test suite is set up simply setting
# that env var here will not have the desired effect. Instead we
# monkey-patch the GPG object that is called crypto_util to imitate the
# _encoding attribute it would have had it been initialized in a "C"
# environment. See
# https://github.com/freedomofpress/securedrop/issues/1360 for context.
encryption_mgr = EncryptionManager.get_default()
encryption_mgr.gpg() # lazily initialize GPG
with mock.patch.object(encryption_mgr._gpg, "_encoding", "ansi_x3.4_1968"):
_helper_test_reply(
journalist_app,
source_app,
test_journo,
"ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ",
)
def test_delete_collection(mocker, source_app, journalist_app, test_journo):
"""Test the "delete collection" button on each collection page"""
# first, add a source
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
app.post("/create", data={"tab_id": tab_id})
resp = app.post(
"/submit",
data=dict(
msg="This is a test.",
fh=(BytesIO(b""), ""),
),
follow_redirects=True,
)
assert resp.status_code == 200
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
resp = app.get("/")
# navigate to the collection page
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
first_col_url = soup.select("table#collections tr.source > th.designation a")[0]["href"]
resp = app.get(first_col_url)
assert resp.status_code == 200
# find the delete form and extract the post parameters
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
delete_form_inputs = soup.select("form#delete-collection")[0]("input")
filesystem_id = delete_form_inputs[1]["value"]
col_name = delete_form_inputs[2]["value"]
resp = app.post("/col/delete/" + filesystem_id, follow_redirects=True)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert escape(f"The account and data for the source {col_name} have been deleted.") in text
assert "There are no submissions!" in text
# Make sure the collection is deleted from the filesystem
def assertion():
assert not os.path.exists(Storage.get_default().path(filesystem_id))
utils.asynchronous.wait_for_assertion(assertion)
def test_delete_collections(mocker, journalist_app, source_app, test_journo):
"""Test the "delete selected" checkboxes on the index page that can be
used to delete multiple collections"""
# first, add some sources
with source_app.test_client() as app:
num_sources = 2
for i in range(num_sources):
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
app.post("/create", data={"tab_id": tab_id})
app.post(
"/submit",
data=dict(
msg="This is a test " + str(i) + ".",
fh=(BytesIO(b""), ""),
),
follow_redirects=True,
)
app.get("/logout")
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
resp = app.get("/")
# get all the checkbox values
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
checkbox_values = [
checkbox["value"] for checkbox in soup.select('input[name="cols_selected"]')
]
resp = app.post(
"/col/process",
data=dict(action="delete", cols_selected=checkbox_values),
follow_redirects=True,
)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
assert f"The accounts and all data for {num_sources} sources" in text
# simulate the source_deleter's work
journalist_app_module.utils.purge_deleted_sources()
# Make sure the collections are deleted from the filesystem
def assertion():
assert not (
any(
[
os.path.exists(Storage.get_default().path(filesystem_id))
for filesystem_id in checkbox_values
]
)
)
utils.asynchronous.wait_for_assertion(assertion)
def _helper_filenames_submit(app):
app.post(
"/submit",
data=dict(
msg="This is a test.",
fh=(BytesIO(b""), ""),
),
follow_redirects=True,
)
app.post(
"/submit",
data=dict(
msg="This is a test.",
fh=(BytesIO(b"This is a test"), "test.txt"),
),
follow_redirects=True,
)
app.post(
"/submit",
data=dict(
msg="",
fh=(BytesIO(b"This is a test"), "test.txt"),
),
follow_redirects=True,
)
def test_filenames(source_app, journalist_app, test_journo):
"""Test pretty, sequential filenames when source uploads messages
and files"""
# add a source and submit stuff
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
app.post("/create", data={"tab_id": tab_id})
_helper_filenames_submit(app)
# navigate to the collection page
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
resp = app.get("/")
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
first_col_url = soup.select("table#collections tr.source > th.designation a")[0]["href"]
resp = app.get(first_col_url)
assert resp.status_code == 200
# test filenames and sort order
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
submission_filename_re = r"^{0}-[a-z0-9-_]+(-msg|-doc\.gz)\.gpg$"
for i, submission_link in enumerate(
soup.select("table#submissions tr.submission > th.filename a")
):
filename = str(submission_link.contents[0])
assert re.match(submission_filename_re.format(i + 1), filename)
def test_filenames_delete(journalist_app, source_app, test_journo):
"""Test pretty, sequential filenames when journalist deletes files"""
# add a source and submit stuff
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
app.post("/create", data={"tab_id": tab_id})
_helper_filenames_submit(app)
# navigate to the collection page
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
resp = app.get("/")
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
first_col_url = soup.select("table#collections tr.source > th.designation a")[0]["href"]
resp = app.get(first_col_url)
assert resp.status_code == 200
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
# delete file #2
_helper_filenames_delete(app, soup, 1)
resp = app.get(first_col_url)
soup = BeautifulSoup(resp.data.decode("utf-8"), "html.parser")
# test filenames and sort order
submission_filename_re = r"^{0}-[a-z0-9-_]+(-msg|-doc\.gz)\.gpg$"
filename = str(
soup.select("table#submissions tr.submission > th.filename a")[0].contents[0]
)
assert re.match(submission_filename_re.format(1), filename)
filename = str(
soup.select("table#submissions tr.submission > th.filename a")[1].contents[0]
)
assert re.match(submission_filename_re.format(3), filename)
filename = str(
soup.select("table#submissions tr.submission > th.filename a")[2].contents[0]
)
assert re.match(submission_filename_re.format(4), filename)
def test_user_change_password(journalist_app, test_journo):
"""Test that a journalist can successfully login after changing
their password"""
with journalist_app.test_client() as app:
login_journalist(
app, test_journo["username"], test_journo["password"], test_journo["otp_secret"]
)
# change password
new_pw = "another correct horse battery staply long password"
assert new_pw != test_journo["password"] # precondition
app.post(
"/account/new-password",
data=dict(
password=new_pw,
current_password=test_journo["password"],
token=TOTP(test_journo["otp_secret"]).now(),
),
)
# logout
app.get("/logout")
# start a new client/context to be sure we've cleared the session
with journalist_app.test_client() as app:
# login with new credentials
login_journalist(app, test_journo["username"], new_pw, test_journo["otp_secret"])
def test_prevent_document_uploads(source_app, journalist_app, test_admin):
"""Test that the source interface accepts only messages when
allow_document_uploads == False.
"""
# Set allow_document_uploads = False:
with journalist_app.test_client() as app:
login_journalist(
app, test_admin["username"], test_admin["password"], test_admin["otp_secret"]
)
form = journalist_app_module.forms.SubmissionPreferencesForm(
prevent_document_uploads=True, min_message_length=0
)
resp = app.post(
"/admin/update-submission-preferences",
data=form.data,
follow_redirects=True,
)
assert resp.status_code == 200
# Check that the source interface accepts only messages:
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
resp = app.post("/create", data={"tab_id": tab_id}, follow_redirects=True)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
soup = BeautifulSoup(text, "html.parser")
assert "Submit Messages" in text
assert len(soup.select('input[type="file"]')) == 0
def test_no_prevent_document_uploads(source_app, journalist_app, test_admin):
"""Test that the source interface accepts both files and messages when
allow_document_uploads == True.
"""
# Set allow_document_uploads = True:
with journalist_app.test_client() as app:
login_journalist(
app, test_admin["username"], test_admin["password"], test_admin["otp_secret"]
)
form = journalist_app_module.forms.SubmissionPreferencesForm(
prevent_document_uploads=False, min_message_length=0
)
resp = app.post(
"/admin/update-submission-preferences",
data=form.data,
follow_redirects=True,
)
assert resp.status_code == 200
# Check that the source interface accepts both files and messages:
with source_app.test_client() as app:
app.post("/generate", data=GENERATE_DATA)
tab_id = next(iter(session["codenames"].keys()))
resp = app.post("/create", data={"tab_id": tab_id}, follow_redirects=True)
assert resp.status_code == 200
text = resp.data.decode("utf-8")
soup = BeautifulSoup(text, "html.parser")
assert "Submit Files or Messages" in text
assert len(soup.select('input[type="file"]')) == 1