mirror of https://gitlab.com/bashrc2/epicyon
Test for getting understood languages string
parent
a480db390a
commit
93b89e0f78
|
@ -30,7 +30,9 @@ def _getActorLanguagesList(actorJson: {}) -> []:
|
||||||
continue
|
continue
|
||||||
if propertyValue['type'] != 'PropertyValue':
|
if propertyValue['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
return propertyValue['value']
|
langList = propertyValue['value']
|
||||||
|
langList.sort()
|
||||||
|
return langList
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
|
6
tests.py
6
tests.py
|
@ -124,6 +124,7 @@ from webapp_post import prepareHtmlPostNickname
|
||||||
from speaker import speakerReplaceLinks
|
from speaker import speakerReplaceLinks
|
||||||
from markdown import markdownToHtml
|
from markdown import markdownToHtml
|
||||||
from languages import setActorLanguages
|
from languages import setActorLanguages
|
||||||
|
from languages import getActorLanguages
|
||||||
|
|
||||||
testServerAliceRunning = False
|
testServerAliceRunning = False
|
||||||
testServerBobRunning = False
|
testServerBobRunning = False
|
||||||
|
@ -4213,8 +4214,7 @@ def _testSetActorLanguages():
|
||||||
actorJson = {
|
actorJson = {
|
||||||
"attachment": []
|
"attachment": []
|
||||||
}
|
}
|
||||||
setActorLanguages(None, actorJson, 'en, es, fr')
|
setActorLanguages(None, actorJson, 'es, fr, en')
|
||||||
print(str(actorJson))
|
|
||||||
assert len(actorJson['attachment']) == 1
|
assert len(actorJson['attachment']) == 1
|
||||||
assert actorJson['attachment'][0]['name'] == 'Languages'
|
assert actorJson['attachment'][0]['name'] == 'Languages'
|
||||||
assert actorJson['attachment'][0]['type'] == 'PropertyValue'
|
assert actorJson['attachment'][0]['type'] == 'PropertyValue'
|
||||||
|
@ -4222,6 +4222,8 @@ def _testSetActorLanguages():
|
||||||
assert 'en' in actorJson['attachment'][0]['value']
|
assert 'en' in actorJson['attachment'][0]['value']
|
||||||
assert 'fr' in actorJson['attachment'][0]['value']
|
assert 'fr' in actorJson['attachment'][0]['value']
|
||||||
assert 'es' in actorJson['attachment'][0]['value']
|
assert 'es' in actorJson['attachment'][0]['value']
|
||||||
|
languagesStr = getActorLanguages(actorJson)
|
||||||
|
assert languagesStr == 'en / es / fr'
|
||||||
|
|
||||||
|
|
||||||
def runAllTests():
|
def runAllTests():
|
||||||
|
|
Loading…
Reference in New Issue