Skip to content

Commit 211a394

Browse files
committed
1 parent ab8d4a0 commit 211a394

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

securedrop/bin/dev-shell

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function docker_run() {
6565
-p "127.0.0.1:${SD_HOSTPORT_SI}:8080" \
6666
-p "127.0.0.1:${SD_HOSTPORT_JI}:8081" \
6767
-e NUM_SOURCES \
68+
-e CLIENT_TEST_DATA \
6869
-e LC_ALL=C.UTF-8 \
6970
-e LANG=C.UTF-8 \
7071
-e PAGE_LAYOUT_LOCALES \

securedrop/create-dev-data.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@
2828
'<strong>This text should not be bold</strong>!'
2929
])
3030

31+
spcial_submissions = cycle([
32+
"""~!@#$%^&*()_+{}|:"<>?~!@#$%^&*()_+{}|:"<>?~!@#$%^&*()_+{}|:"<>?~!@#$%""",
33+
"""Ω≈ç√∫˜µ≤≥÷
34+
åß∂ƒ©˙∆˚¬…æ
35+
œ∑´®†¥¨ˆøπ“‘
36+
¡™£¢∞§¶•ªº–≠
37+
¸˛Ç◊ı˜Â¯˘¿
38+
ÅÍÎÏ˝ÓÔÒÚÆ☃
39+
Œ„´‰ˇÁ¨ˆØ∏”""",
40+
"""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$""" # noqa: W605, E501
41+
"""............................................................................................................................ .""", # noqa: W605, E501
42+
43+
"""thisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwithoutspacesordashesthisisalongwordwit💩houtspacesordashes""", # noqa: W605, E501
44+
45+
"""😍😍😍😍🔥🔥🔥🔥🔥🖧Thelastwas3networkedcomuters📟📸longwordwit💩houtspacesordashes""" # noqa: W605, E501
46+
47+
48+
49+
]
50+
)
51+
3152

3253
def main(staging=False):
3354
app = journalist_app.create_app(config)
@@ -66,6 +87,10 @@ def main(staging=False):
6687
)
6788
continue
6889
create_source_and_submissions(i, num_sources)
90+
91+
client_test = int(os.getenv('CLIENT_TEST_DATA', 0))
92+
for i in range(1, client_test):
93+
create_source_and_submissions(i, client_test, client_test_data=True)
6994
# Now let us delete one journalist
7095
db.session.delete(journalist_tobe_deleted)
7196
db.session.commit()
@@ -92,7 +117,7 @@ def add_test_user(username, password, otp_secret, is_admin=False,
92117

93118

94119
def create_source_and_submissions(
95-
source_index, source_count, num_submissions=2, num_replies=2, journalist_who_replied=None
120+
source_index, source_count, num_submissions=2, num_replies=2, journalist_who_replied=None, client_test_data=False # noqa: W605, E501
96121
):
97122
# Store source in database
98123
codename = current_app.crypto_util.genrandomid()
@@ -110,11 +135,15 @@ def create_source_and_submissions(
110135
# Generate some test submissions
111136
for _ in range(num_submissions):
112137
source.interaction_count += 1
138+
if client_test_data:
139+
submission_text = next(spcial_submissions)
140+
else:
141+
submission_text = next(submissions)
113142
fpath = current_app.storage.save_message_submission(
114143
source.filesystem_id,
115144
source.interaction_count,
116145
source.journalist_filename,
117-
next(submissions)
146+
submission_text
118147
)
119148
source.last_updated = datetime.datetime.utcnow()
120149
submission = Submission(source, fpath)

0 commit comments

Comments
 (0)