Skip to content

Commit b15aff2

Browse files
jernstJohannes Ernst
andauthored
Fix interactive prompts. (#434)
Closes #431 Closes #432 Co-authored-by: Johannes Ernst <git@j12t.org>
1 parent 056dd08 commit b15aff2

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/feditest/nodedrivers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@ def provision_non_existing_account_for_role(self, role: str | None = None) -> No
454454

455455

456456
def add_cert_to_trust_store(self, root_cert: str) -> None:
457-
prompt_user(f'Please add this temporary certificate to the trust root of node { self } and hit return when done:\n' + root_cert)
457+
prompt_user(f'Please add this temporary certificate to the trust root of node { self } and hit return when done:\n{ root_cert }\nHit return: ')
458458

459459

460460
def remove_cert_from_trust_store(self, root_cert: str) -> None:
461-
prompt_user(f'Please remove this previously-added temporary certificate from the trust store of node { self } and hit return when done:\n' + root_cert)
461+
prompt_user(f'Please remove this previously-added temporary certificate from the trust store of node { self } and hit return when done:\n{ root_cert }\nHit return: ')
462462

463463

464464
def __str__(self) -> str:

src/feditest/nodedrivers/fallback/fediverse.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,20 @@ def obtain_non_existing_actor_acct_uri(self, rolename: str | None = None ) -> st
7878
def make_follow(self, actor_acct_uri: str, to_follow_actor_acct_uri: str) -> None:
7979
prompt_user(
8080
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" follow actor "{ to_follow_actor_acct_uri }"'
81-
+ ' and hit return when done.')
81+
+ ' and hit return when done: ')
8282

8383

8484
def make_unfollow(self, actor_acct_uri: str, following_actor_acct_uri: str) -> None:
8585
prompt_user(
8686
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" unfollow actor "{ following_actor_acct_uri }"'
87-
+ ' and hit return when done.')
87+
+ ' and hit return when done: ')
8888

8989

9090
# Python 3.12 @override
9191
def actor_is_following_actor(self, actor_acct_uri: str, leader_actor_acct_uri: str) -> bool:
9292
answer = prompt_user_parse_validate(
9393
f'On FediverseNode "{ self.hostname }", is actor "{ actor_acct_uri }" following actor "{ leader_actor_acct_uri }"?'
94-
+ ' Enter "true" or "false".',
94+
+ ' Enter "true" or "false": ',
9595
parse_validate=boolean_parse_validate)
9696
return answer
9797

@@ -100,7 +100,7 @@ def actor_is_following_actor(self, actor_acct_uri: str, leader_actor_acct_uri: s
100100
def actor_is_followed_by_actor(self, actor_acct_uri: str, follower_actor_acct_uri: str) -> bool:
101101
answer = prompt_user_parse_validate(
102102
f'On FediverseNode "{ self.hostname }", is actor "{ actor_acct_uri }" being followed by actor "{ follower_actor_acct_uri }"?'
103-
+ ' Enter "true" or "false".',
103+
+ ' Enter "true" or "false": ',
104104
parse_validate=boolean_parse_validate)
105105
return answer
106106

@@ -113,58 +113,58 @@ def make_create_note(self, actor_acct_uri: str, content: str, deliver_to: list[s
113113
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" create a Note'
114114
+ ' to be delivered to ' + ", ".join(deliver_to)
115115
+ ' and enter its URI when created.'
116-
+ f' Note content:"""\n{ content }\n"""',
116+
+ f' Note content (between the quotes):\n"""\n{ content }\n"""\nURI: ',
117117
parse_validate=https_uri_validate)
118118
return prompt_user_parse_validate(
119119
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" create a Note'
120120
+ ' and enter its URI when created.'
121-
+ f' Note content:"""\n{ content }\n"""',
121+
+ f' Note content (between the quotes):\n"""\n{ content }\n"""\nURI: ',
122122
parse_validate=https_uri_validate)
123123

124124

125125
# Python 3.12 @override
126126
def update_note(self, actor_acct_uri: str, note_uri: str, new_content: str) -> None:
127127
prompt_user(
128128
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" update the note at "{ note_uri }"'
129-
+ ' with new content:"""\n{ new_content }\n"""'
130-
+ ' and hit return when done.')
129+
+ ' with new conten (between the quotes):\n"""\n{ new_content }\n"""\n'
130+
+ 'and hit return when done: ')
131131

132132

133133
# Python 3.12 @override
134134
def delete_object(self, actor_acct_uri: str, object_uri: str) -> None:
135135
prompt_user(
136136
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" delete the object at "{ object_uri }"'
137-
+ ' and hit return when done.')
137+
+ ' and hit return when done:')
138138

139139

140140
# Python 3.12 @override
141141
def make_reply_note(self, actor_acct_uri, to_be_replied_to_object_uri: str, reply_content: str) -> str:
142142
return prompt_user_parse_validate(
143143
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" reply to object with "{ to_be_replied_to_object_uri }"'
144144
+ ' and enter the reply note\'s URI when created.'
145-
+ f' Reply content:"""\n{ reply_content }\n"""',
145+
+ f' Reply content (between the quotes):\n"""\n{ reply_content }\n"""\nURI: ',
146146
parse_validate=https_uri_validate)
147147

148148

149149
# Python 3.12 @override
150150
def like_object(self, actor_acct_uri: str, object_uri: str) -> None:
151151
prompt_user(
152152
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" like the object at "{ object_uri }"'
153-
+ ' and hit return when done.')
153+
+ ' and hit return when done: ')
154154

155155

156156
# Python 3.12 @override
157157
def unlike_object(self, actor_acct_uri: str, object_uri: str) -> None:
158158
prompt_user(
159159
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" unlike the object at "{ object_uri }"'
160-
+ ' and hit return when done.')
160+
+ ' and hit return when done: ')
161161

162162

163163
# Python 3.12 @override
164164
def announce_object(self, actor_acct_uri: str, object_uri: str) -> None:
165165
prompt_user(
166166
f'On FediverseNode "{ self.hostname }", make actor "{ actor_acct_uri }" announce/reblog/boost the object at "{ object_uri }"'
167-
+ ' and hit return when done.')
167+
+ ' and hit return when done: ')
168168

169169

170170
# Python 3.12 @override
@@ -178,21 +178,21 @@ def unannounce_object(self, actor_acct_uri: str, object_uri: str) -> None:
178178
def actor_has_received_object(self, actor_acct_uri: str, object_uri: str) -> str | None:
179179
answer = prompt_user(
180180
f'On FediverseNode "{ self.hostname }", has actor "{ actor_acct_uri }" received the object "{ object_uri }"?'
181-
+ ' Enter the content of the object, or leave empty if it didn\'t happen.')
181+
+ ' Enter the content of the object, or leave empty if it didn\'t happen: ')
182182
return answer if answer else None
183183

184184

185185
# Python 3.12 @override
186186
def note_content(self, actor_acct_uri: str, note_uri: str) -> str | None:
187187
answer = prompt_user(
188-
f'On FediverseNode "{ self.hostname }", have actor "{ actor_acct_uri }" access note "{ note_uri }" and enter its content.')
188+
f'On FediverseNode "{ self.hostname }", have actor "{ actor_acct_uri }" access note "{ note_uri }" and enter its content: ')
189189
return answer if answer else None
190190

191191

192192
# Python 3.12 @override
193193
def object_author(self, actor_acct_uri: str, object_uri: str) -> str | None:
194194
answer = prompt_user_parse_validate(
195-
f'On FediverseNode "{ self.hostname }", have actor "{ actor_acct_uri }" access object "{ object_uri }" and enter the acct URI of the object\'s author.',
195+
f'On FediverseNode "{ self.hostname }", have actor "{ actor_acct_uri }" access object "{ object_uri }" and enter the acct URI of the object\'s author: ',
196196
parse_validate=acct_uri_validate)
197197
return answer
198198

@@ -201,7 +201,7 @@ def object_author(self, actor_acct_uri: str, object_uri: str) -> str | None:
201201
def direct_replies_to_object(self, actor_acct_uri: str, object_uri: str) -> list[str]:
202202
answer = prompt_user_parse_validate(
203203
f'On FediverseNode "{ self.hostname }", have actor "{ actor_acct_uri }" access object "{ object_uri }"'
204-
+ ' and enter the https URIs of all objects that directly reply to it (space-separated list).',
204+
+ ' and enter the https URIs of all objects that directly reply to it (space-separated list): ',
205205
parse_validate=https_uri_list_validate)
206206
return answer.split()
207207

@@ -210,7 +210,7 @@ def direct_replies_to_object(self, actor_acct_uri: str, object_uri: str) -> list
210210
def object_likers(self, actor_acct_uri: str, object_uri: str) -> list[str]:
211211
answer = prompt_user_parse_validate(
212212
f'On FediverseNode "{ self.hostname }", have actor "{ actor_acct_uri }" access object "{ object_uri }"'
213-
+ ' and enter the acct URIs of all accounts that like it (space-separated list).',
213+
+ ' and enter the acct URIs of all accounts that like it (space-separated list): ',
214214
parse_validate=acct_uri_list_validate)
215215
return answer.split()
216216

@@ -219,7 +219,7 @@ def object_likers(self, actor_acct_uri: str, object_uri: str) -> list[str]:
219219
def object_announcers(self, actor_acct_uri: str, object_uri: str) -> list[str]:
220220
answer = prompt_user_parse_validate(
221221
f'On FediverseNode "{ self.hostname }", have actor "{ actor_acct_uri }" access object "{ object_uri }"'
222-
+ ' and enter the acct URIs of all accounts that have announced/reblogged/boosted it (space-separated list).',
222+
+ ' and enter the acct URIs of all accounts that have announced/reblogged/boosted it (space-separated list): ',
223223
parse_validate=acct_uri_list_validate)
224224
return answer.split()
225225

src/feditest/nodedrivers/manual/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class FediverseManualNodeDriver(AbstractFallbackFediverseNodeDriver):
1616
def _provision_node(self, rolename: str, config: NodeConfiguration, account_manager: AccountManager | None) -> FediverseNode:
1717
prompt_user(
1818
f'Manually provision the Node for constellation role { rolename }'
19-
+ f' at host { config.hostname } with app { config.app } and hit return when done.')
19+
+ f' at host { config.hostname } with app { config.app } and hit return when done: ')
2020
return FallbackFediverseNode(rolename, config, account_manager)
2121

2222

2323
# Python 3.12 @override
2424
def _unprovision_node(self, node: Node) -> None:
25-
prompt_user(f'Manually unprovision the Node for constellation role { node.rolename } and hit return when done.')
25+
prompt_user(f'Manually unprovision the Node for constellation role { node.rolename } and hit return when done: ')

0 commit comments

Comments
 (0)