mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
6f8944ed40
commit
6f18cec3a9
10
tests.py
10
tests.py
|
@ -62,7 +62,7 @@ from utils import get_actor_languages_list
|
||||||
from utils import get_category_types
|
from utils import get_category_types
|
||||||
from utils import get_supported_languages
|
from utils import get_supported_languages
|
||||||
from utils import setConfigParam
|
from utils import setConfigParam
|
||||||
from utils import isGroupActor
|
from utils import is_group_actor
|
||||||
from utils import dateStringToSeconds
|
from utils import dateStringToSeconds
|
||||||
from utils import dateSecondsToString
|
from utils import dateSecondsToString
|
||||||
from utils import validPassword
|
from utils import validPassword
|
||||||
|
@ -1556,7 +1556,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
|
||||||
assert 'bob@' + bobDomain in open(aliceDir + '/accounts/alice@' +
|
assert 'bob@' + bobDomain in open(aliceDir + '/accounts/alice@' +
|
||||||
aliceDomain +
|
aliceDomain +
|
||||||
'/followingCalendar.txt').read()
|
'/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)
|
assert not is_group_account(aliceDir, 'alice', aliceDomain)
|
||||||
|
|
||||||
print('\n\n*********************************************************')
|
print('\n\n*********************************************************')
|
||||||
|
@ -1773,7 +1773,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
||||||
assert 'bob@' + bobDomain in open(aliceDir + '/accounts/alice@' +
|
assert 'bob@' + bobDomain in open(aliceDir + '/accounts/alice@' +
|
||||||
aliceDomain +
|
aliceDomain +
|
||||||
'/followingCalendar.txt').read()
|
'/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)
|
assert not is_group_account(bobDir, 'bob', bobDomain)
|
||||||
|
|
||||||
print('\n\n*********************************************************')
|
print('\n\n*********************************************************')
|
||||||
|
@ -2230,7 +2230,7 @@ def testGroupFollow(base_dir: str) -> None:
|
||||||
if '!testgroup' not in followingStr:
|
if '!testgroup' not in followingStr:
|
||||||
print('Alice following.txt does not contain !testgroup@' +
|
print('Alice following.txt does not contain !testgroup@' +
|
||||||
testgroupDomain + ':' + str(testgroupPort))
|
testgroupDomain + ':' + str(testgroupPort))
|
||||||
assert isGroupActor(aliceDir, testgroupActor, alicePersonCache)
|
assert is_group_actor(aliceDir, testgroupActor, alicePersonCache)
|
||||||
assert not is_group_account(aliceDir, 'alice', aliceDomain)
|
assert not is_group_account(aliceDir, 'alice', aliceDomain)
|
||||||
assert is_group_account(testgroupDir, 'testgroup', testgroupDomain)
|
assert is_group_account(testgroupDir, 'testgroup', testgroupDomain)
|
||||||
assert '!testgroup' in followingStr
|
assert '!testgroup' in followingStr
|
||||||
|
@ -2306,7 +2306,7 @@ def testGroupFollow(base_dir: str) -> None:
|
||||||
if '!testgroup' not in followingStr:
|
if '!testgroup' not in followingStr:
|
||||||
print('Bob following.txt does not contain !testgroup@' +
|
print('Bob following.txt does not contain !testgroup@' +
|
||||||
testgroupDomain + ':' + str(testgroupPort))
|
testgroupDomain + ':' + str(testgroupPort))
|
||||||
assert isGroupActor(bobDir, testgroupActor, bobPersonCache)
|
assert is_group_actor(bobDir, testgroupActor, bobPersonCache)
|
||||||
assert '!testgroup' in followingStr
|
assert '!testgroup' in followingStr
|
||||||
assert testgroupHandle in open(bobFollowingFilename).read()
|
assert testgroupHandle in open(bobFollowingFilename).read()
|
||||||
assert testgroupHandle in open(bobFollowingCalendarFilename).read()
|
assert testgroupHandle in open(bobFollowingCalendarFilename).read()
|
||||||
|
|
16
utils.py
16
utils.py
|
@ -3001,11 +3001,11 @@ def hasGroupType(base_dir: str, actor: str, person_cache: {},
|
||||||
print('grpPath ' + grpPath + ' in ' + actor)
|
print('grpPath ' + grpPath + ' in ' + actor)
|
||||||
return True
|
return True
|
||||||
# is there a cached actor which can be examined for Group type?
|
# 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: {},
|
def is_group_actor(base_dir: str, actor: str, person_cache: {},
|
||||||
debug: bool = False) -> bool:
|
debug: bool = False) -> bool:
|
||||||
"""Is the given actor a group?
|
"""Is the given actor a group?
|
||||||
"""
|
"""
|
||||||
if person_cache:
|
if person_cache:
|
||||||
|
@ -3019,15 +3019,15 @@ def isGroupActor(base_dir: str, actor: str, person_cache: {},
|
||||||
return False
|
return False
|
||||||
if debug:
|
if debug:
|
||||||
print('Actor ' + actor + ' not in cache')
|
print('Actor ' + actor + ' not in cache')
|
||||||
cachedActorFilename = \
|
cached_actor_filename = \
|
||||||
base_dir + '/cache/actors/' + (actor.replace('/', '#')) + '.json'
|
base_dir + '/cache/actors/' + (actor.replace('/', '#')) + '.json'
|
||||||
if not os.path.isfile(cachedActorFilename):
|
if not os.path.isfile(cached_actor_filename):
|
||||||
if debug:
|
if debug:
|
||||||
print('Cached actor file not found ' + cachedActorFilename)
|
print('Cached actor file not found ' + cached_actor_filename)
|
||||||
return False
|
return False
|
||||||
if '"type": "Group"' in open(cachedActorFilename).read():
|
if '"type": "Group"' in open(cached_actor_filename).read():
|
||||||
if debug:
|
if debug:
|
||||||
print('Group type found in ' + cachedActorFilename)
|
print('Group type found in ' + cached_actor_filename)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue