Snake case

merge-requests/30/head
Bob Mottram 2022-06-08 21:20:27 +01:00
parent 8bf7e2b5b3
commit d9309438f1
1 changed files with 16 additions and 16 deletions

View File

@ -705,7 +705,7 @@ def _test_threads():
def create_server_alice(path: str, domain: str, port: int, def create_server_alice(path: str, domain: str, port: int,
bob_address: str, federation_list: [], bob_address: str, federation_list: [],
hasFollows: bool, hasPosts: bool, has_follows: bool, has_posts: bool,
send_threads: []): send_threads: []):
print('Creating test server: Alice on port ' + str(port)) print('Creating test server: Alice on port ' + str(port))
if os.path.isdir(path): if os.path.isdir(path):
@ -735,12 +735,12 @@ def create_server_alice(path: str, domain: str, port: int,
delete_all_posts(path, nickname, domain, 'outbox') delete_all_posts(path, nickname, domain, 'outbox')
assert set_skill_level(path, nickname, domain, 'hacking', 90) assert set_skill_level(path, nickname, domain, 'hacking', 90)
assert set_role(path, nickname, domain, 'guru') assert set_role(path, nickname, domain, 'guru')
if hasFollows: if has_follows:
follow_person(path, nickname, domain, 'bob', bob_address, follow_person(path, nickname, domain, 'bob', bob_address,
federation_list, False, False) federation_list, False, False)
add_follower_of_person(path, nickname, domain, 'bob', bob_address, add_follower_of_person(path, nickname, domain, 'bob', bob_address,
federation_list, False, False) federation_list, False, False)
if hasPosts: if has_posts:
test_save_to_file = True test_save_to_file = True
client_to_server = False client_to_server = False
test_comments_enabled = True test_comments_enabled = True
@ -865,7 +865,7 @@ def create_server_alice(path: str, domain: str, port: int,
def create_server_bob(path: str, domain: str, port: int, def create_server_bob(path: str, domain: str, port: int,
alice_address: str, federation_list: [], alice_address: str, federation_list: [],
hasFollows: bool, hasPosts: bool, has_follows: bool, has_posts: bool,
send_threads: []): send_threads: []):
print('Creating test server: Bob on port ' + str(port)) print('Creating test server: Bob on port ' + str(port))
if os.path.isdir(path): if os.path.isdir(path):
@ -894,13 +894,13 @@ def create_server_bob(path: str, domain: str, port: int,
assert wf_endpoint assert wf_endpoint
delete_all_posts(path, nickname, domain, 'inbox') delete_all_posts(path, nickname, domain, 'inbox')
delete_all_posts(path, nickname, domain, 'outbox') delete_all_posts(path, nickname, domain, 'outbox')
if hasFollows and alice_address: if has_follows and alice_address:
follow_person(path, nickname, domain, follow_person(path, nickname, domain,
'alice', alice_address, federation_list, False, False) 'alice', alice_address, federation_list, False, False)
add_follower_of_person(path, nickname, domain, add_follower_of_person(path, nickname, domain,
'alice', alice_address, federation_list, 'alice', alice_address, federation_list,
False, False) False, False)
if hasPosts: if has_posts:
test_save_to_file = True test_save_to_file = True
test_comments_enabled = True test_comments_enabled = True
test_attach_image_filename = None test_attach_image_filename = None
@ -1023,7 +1023,7 @@ def create_server_bob(path: str, domain: str, port: int,
def create_server_eve(path: str, domain: str, port: int, federation_list: [], def create_server_eve(path: str, domain: str, port: int, federation_list: [],
hasFollows: bool, hasPosts: bool, has_follows: bool, has_posts: bool,
send_threads: []): send_threads: []):
print('Creating test server: Eve on port ' + str(port)) print('Creating test server: Eve on port ' + str(port))
if os.path.isdir(path): if os.path.isdir(path):
@ -1104,7 +1104,7 @@ def create_server_eve(path: str, domain: str, port: int, federation_list: [],
def create_server_group(path: str, domain: str, port: int, def create_server_group(path: str, domain: str, port: int,
federation_list: [], federation_list: [],
hasFollows: bool, hasPosts: bool, has_follows: bool, has_posts: bool,
send_threads: []): send_threads: []):
print('Creating test server: Group on port ' + str(port)) print('Creating test server: Group on port ' + str(port))
if os.path.isdir(path): if os.path.isdir(path):
@ -1440,7 +1440,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
True, __version__, signing_priv_key_pem, True, __version__, signing_priv_key_pem,
bob_domain, None, None) bob_domain, None, None)
for i in range(20): for _ in range(20):
if 'reactions' in open(outbox_post_filename).read(): if 'reactions' in open(outbox_post_filename).read():
break break
time.sleep(1) time.sleep(1)
@ -1478,7 +1478,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
bob_domain, None, None) bob_domain, None, None)
announce_message_arrived = False announce_message_arrived = False
outbox_message_arrived = False outbox_message_arrived = False
for i in range(20): for _ in range(20):
time.sleep(1) time.sleep(1)
if not os.path.isdir(inbox_path): if not os.path.isdir(inbox_path):
continue continue
@ -1679,7 +1679,7 @@ def test_follow_between_servers(base_dir: str) -> None:
queue_path = bob_dir + '/accounts/bob@' + bob_domain + '/queue' queue_path = bob_dir + '/accounts/bob@' + bob_domain + '/queue'
inbox_path = bob_dir + '/accounts/bob@' + bob_domain + '/inbox' inbox_path = bob_dir + '/accounts/bob@' + bob_domain + '/inbox'
alice_message_arrived = False alice_message_arrived = False
for i in range(20): for _ in range(20):
time.sleep(1) time.sleep(1)
if os.path.isdir(inbox_path): if os.path.isdir(inbox_path):
if len([name for name in os.listdir(inbox_path) if len([name for name in os.listdir(inbox_path)
@ -3030,8 +3030,8 @@ def test_client_to_server(base_dir: str):
print('Bob follows the calendar of Alice') print('Bob follows the calendar of Alice')
following_cal_path = \ following_cal_path = \
bob_dir + '/accounts/bob@' + bob_domain + '/followingCalendar.txt' bob_dir + '/accounts/bob@' + bob_domain + '/followingCalendar.txt'
with open(following_cal_path, 'w+') as fp: with open(following_cal_path, 'w+') as fp_foll:
fp.write('alice@' + alice_domain + '\n') fp_foll.write('alice@' + alice_domain + '\n')
print('\n\n*******************************************************') print('\n\n*******************************************************')
print('EVENT: Alice sends to Bob via c2s') print('EVENT: Alice sends to Bob via c2s')
@ -4477,7 +4477,7 @@ def _test_hashtag_rules():
tree = hashtag_rule_tree(operators, conditions_str, tree = hashtag_rule_tree(operators, conditions_str,
tags_in_conditions, moderated) tags_in_conditions, moderated)
assert tree is None assert tree is None
assert tags_in_conditions == [] assert not tags_in_conditions
hashtags = ['#foo'] hashtags = ['#foo']
assert not hashtag_rule_resolve(tree, hashtags, moderated, content, url) assert not hashtag_rule_resolve(tree, hashtags, moderated, content, url)
@ -5118,7 +5118,7 @@ def _test_thread_functions():
if def_str not in modules[mod_name]['source']: if def_str not in modules[mod_name]['source']:
print(mod_name + ' ' + first_parameter) print(mod_name + ' ' + first_parameter)
print(import_str + ' not in ' + mod_name) print(import_str + ' not in ' + mod_name)
assert(False) assert False
if def_str in modules[mod_name]['source']: if def_str in modules[mod_name]['source']:
defininition_module = mod_name defininition_module = mod_name
else: else:
@ -5172,7 +5172,7 @@ def _test_thread_functions():
' were given in module ' + mod_name) ' were given in module ' + mod_name)
print(str(definition_function_args_list)) print(str(definition_function_args_list))
print(str(calling_function_args_list)) print(str(calling_function_args_list))
assert(False) assert False
ctr += 1 ctr += 1