Snake case

main
Bob Mottram 2021-12-26 17:41:07 +00:00
parent 6f8944ed40
commit 6f18cec3a9
2 changed files with 13 additions and 13 deletions

View File

@ -62,7 +62,7 @@ from utils import get_actor_languages_list
from utils import get_category_types
from utils import get_supported_languages
from utils import setConfigParam
from utils import isGroupActor
from utils import is_group_actor
from utils import dateStringToSeconds
from utils import dateSecondsToString
from utils import validPassword
@ -1556,7 +1556,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
assert 'bob@' + bobDomain in open(aliceDir + '/accounts/alice@' +
aliceDomain +
'/followingCalendar.txt').read()
assert not isGroupActor(aliceDir, bobActor, alicePersonCache)
assert not is_group_actor(aliceDir, bobActor, alicePersonCache)
assert not is_group_account(aliceDir, 'alice', aliceDomain)
print('\n\n*********************************************************')
@ -1773,7 +1773,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
assert 'bob@' + bobDomain in open(aliceDir + '/accounts/alice@' +
aliceDomain +
'/followingCalendar.txt').read()
assert not isGroupActor(aliceDir, bobActor, alicePersonCache)
assert not is_group_actor(aliceDir, bobActor, alicePersonCache)
assert not is_group_account(bobDir, 'bob', bobDomain)
print('\n\n*********************************************************')
@ -2230,7 +2230,7 @@ def testGroupFollow(base_dir: str) -> None:
if '!testgroup' not in followingStr:
print('Alice following.txt does not contain !testgroup@' +
testgroupDomain + ':' + str(testgroupPort))
assert isGroupActor(aliceDir, testgroupActor, alicePersonCache)
assert is_group_actor(aliceDir, testgroupActor, alicePersonCache)
assert not is_group_account(aliceDir, 'alice', aliceDomain)
assert is_group_account(testgroupDir, 'testgroup', testgroupDomain)
assert '!testgroup' in followingStr
@ -2306,7 +2306,7 @@ def testGroupFollow(base_dir: str) -> None:
if '!testgroup' not in followingStr:
print('Bob following.txt does not contain !testgroup@' +
testgroupDomain + ':' + str(testgroupPort))
assert isGroupActor(bobDir, testgroupActor, bobPersonCache)
assert is_group_actor(bobDir, testgroupActor, bobPersonCache)
assert '!testgroup' in followingStr
assert testgroupHandle in open(bobFollowingFilename).read()
assert testgroupHandle in open(bobFollowingCalendarFilename).read()

View File

@ -3001,11 +3001,11 @@ def hasGroupType(base_dir: str, actor: str, person_cache: {},
print('grpPath ' + grpPath + ' in ' + actor)
return True
# is there a cached actor which can be examined for Group type?
return isGroupActor(base_dir, actor, person_cache, debug)
return is_group_actor(base_dir, actor, person_cache, debug)
def isGroupActor(base_dir: str, actor: str, person_cache: {},
debug: bool = False) -> bool:
def is_group_actor(base_dir: str, actor: str, person_cache: {},
debug: bool = False) -> bool:
"""Is the given actor a group?
"""
if person_cache:
@ -3019,15 +3019,15 @@ def isGroupActor(base_dir: str, actor: str, person_cache: {},
return False
if debug:
print('Actor ' + actor + ' not in cache')
cachedActorFilename = \
cached_actor_filename = \
base_dir + '/cache/actors/' + (actor.replace('/', '#')) + '.json'
if not os.path.isfile(cachedActorFilename):
if not os.path.isfile(cached_actor_filename):
if debug:
print('Cached actor file not found ' + cachedActorFilename)
print('Cached actor file not found ' + cached_actor_filename)
return False
if '"type": "Group"' in open(cachedActorFilename).read():
if '"type": "Group"' in open(cached_actor_filename).read():
if debug:
print('Group type found in ' + cachedActorFilename)
print('Group type found in ' + cached_actor_filename)
return True
return False