From 5d2b45560e6e626260fb137e339dd470378b35fd Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 24 Nov 2020 10:53:10 +0000 Subject: [PATCH] Unit test for valid nickname --- tests.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests.py b/tests.py index e42a6c93..aae2345b 100644 --- a/tests.py +++ b/tests.py @@ -32,6 +32,7 @@ from follow import clearFollows from follow import clearFollowers from follow import sendFollowRequestViaServer from follow import sendUnfollowRequestViaServer +from utils import validNickname from utils import firstParagraphFromString from utils import removeIdEnding from utils import siteIsActive @@ -2403,8 +2404,26 @@ def testParseFeedDate(): assert publishedDate == "2020-11-22 18:51:33+00:00" +def testValidNickname(): + print('testValidNickname') + domain = 'somedomain.net' + + nickname = 'myvalidnick' + assert validNickname(domain, nickname) + + nickname = 'my.invalid.nick' + assert not validNickname(domain, nickname) + + nickname = 'myinvalidnick?' + assert not validNickname(domain, nickname) + + nickname = 'my invalid nick?' + assert not validNickname(domain, nickname) + + def runAllTests(): print('Running tests...') + testValidNickname() testParseFeedDate() testFirstParagraphFromString() testGetNewswireTags()