lindsay-stevens/limesurveyrc2api

Three fails and one error within unittest

Closed this issue · 2 comments

Calling python3.6 -m unittest revealed the following error and fails:


======================================================================
ERROR: test_get_participant_properties_success (tests.test__token.TestTokensWithExisting)
Querying for a unique token should return its properties.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/elke/Dokumente/Uni/limesurveyrc2api/tests/test__token.py", line 222, in test_get_participant_properties_success
    survey_id=self.survey_id, token_id=token0["tid"])
  File "/home/elke/Dokumente/Uni/limesurveyrc2api/limesurveyrc2api/_token.py", line 139, in get_participant_properties
    raise LimeSurveyError(method, status)
limesurveyrc2api.exceptions.LimeSurveyError: ('get_participant_properties', 'No valid Data')

======================================================================
FAIL: test_invite_participants_success (tests.test__token.TestTokens)
Sending invites for survey participants should relay all invites.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/elke/Dokumente/Uni/limesurveyrc2api/tests/test__token.py", line 102, in test_invite_participants_success
    self.assertEqual(len(participants), len(cas.messages))
AssertionError: 3 != 0

======================================================================
FAIL: test_invite_participants_uninvited_success (tests.test__token.TestTokens)
Re-sending invites with uninvited_only=False should not re-send.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/elke/Dokumente/Uni/limesurveyrc2api/tests/test__token.py", line 142, in test_invite_participants_uninvited_success
    self.assertEqual(len(participants), len(cas.messages))
AssertionError: 3 != 0

======================================================================
FAIL: test_get_summary_count_success (tests.test__token.TestTokensWithExisting)
Querying a survey for a token count should return accurate result.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/elke/Dokumente/Uni/limesurveyrc2api/tests/test__token.py", line 201, in test_get_summary_count_success
    self.assertEqual(len(self.participants), int(result["token_count"]))
AssertionError: 3 != 10

----------------------------------------------------------------------
Ran 28 tests in 10.583s

FAILED (failures=3, errors=1)

The error might be related with the problem, that 'tid' is returned as string, but get_participant_properties wants an int. But simply doing a type conversion did not solve the problem.

Ok the last fail happens because there already had been participants in my test survey before testing.

Probably just due to interrupted/failed cleanup between test runs.