JStreet-Sensei / jstreet-backend

Learning Japanese web app with slang words.
0 stars 1 forks source link

[BUG]Test for endpoints doesn't work. #25

Open ebisuG opened 2 months ago

ebisuG commented 2 months ago

Describe the bug Almost all tests for basic endpoints seems those don't work. At the first place, it doesn't start to run.

To Reproduce Run test with django test command.

Expected behavior Run successfully tests not regardless of the result of tests.

ebisuG commented 2 months ago

These are errors after fixing typo, and the part that creates wrong data with incorrect relationships.

 docker exec -it f95c9128e4ac2df9c23817f6159f67724e00e6c01031aeacfe9e9f09aa7e0aa5 python manage.py test
Found 27 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
F....F.F...F....
======================================================================
FAIL: test_create_game_name (api.tests.GameNameTests.test_create_game_name)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 187, in test_create_game_name
    self.assertEqual(response.status_code, status.HTTP_201_CREATED)
AssertionError: 400 != 201

======================================================================
FAIL: test_create_lobby (api.tests.LobbyTests.test_create_lobby)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 143, in test_create_lobby
    self.assertEqual(response.status_code, status.HTTP_201_CREATED)
AssertionError: 400 != 201

======================================================================
FAIL: test_get_lobby_detail (api.tests.LobbyTests.test_get_lobby_detail)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 156, in test_get_lobby_detail
    self.assertEqual(response.data["game_type"], self.lobby.game_type)
AssertionError: 1 != <GameName: Multiplayer>

======================================================================
FAIL: test_update_lobby (api.tests.LobbyTests.test_update_lobby)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 165, in test_update_lobby
    self.assertEqual(response.status_code, status.HTTP_200_OK)
AssertionError: 400 != 200

======================================================================
FAIL: test_quick_answer_game_content (api.tests.QuickAnswerGameTests.test_quick_answer_game_content)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 373, in test_quick_answer_game_content
    self.assertEqual(len(response.data["deals"]), 10)
AssertionError: 1 != 10

======================================================================
FAIL: test_update_score (api.tests.ScoreTests.test_update_score)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 105, in test_update_score
    self.assertEqual(response.status_code, status.HTTP_200_OK)
AssertionError: 400 != 200

======================================================================
FAIL: test_create_user (api.tests.UserTests.test_create_user)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 23, in test_create_user
    self.assertEqual(response.status_code, status.HTTP_201_CREATED)
AssertionError: 400 != 201

======================================================================
FAIL: test_update_user (api.tests.UserTests.test_update_user)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/backend/api/tests.py", line 43, in test_update_user
    self.assertEqual(response.status_code, status.HTTP_200_OK)
AssertionError: 400 != 200

----------------------------------------------------------------------
Ran 27 tests in 1.321s

FAILED (failures=8)
Destroying test database for alias 'default'...

What's next:
    Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug f95c9128e4ac2df9c23817f6159f67724e00e6c01031aeacfe9e9f09aa7e0aa5
    Learn more at https://docs.docker.com/go/debug-cli/