Skip to content

Commit

Permalink
Update board test
Browse files Browse the repository at this point in the history
  • Loading branch information
injoonH committed Oct 13, 2022
1 parent b082336 commit 12ded25
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tests/test_board.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import pytest
from rest_framework import status

from apps.core.models import Board
from tests.conftest import RequestSetting, TestCase


@pytest.mark.usefixtures('set_user_client')
@pytest.mark.usefixtures("set_user_client")
class TestBoard(TestCase, RequestSetting):

def test_list(self):
Board.objects.create(ko_name='자유 게시판',
en_name='Free Board',
ko_description='자유 게시판 입니다.',
en_description='This is a free board.')
Board.objects.create(
ko_name="자유 게시판",
en_name="Free Board",
ko_description="자유 게시판 입니다.",
en_description="This is a free board.",
)

boards = self.http_request(self.user, "get", "boards")

assert boards.status_code == status.HTTP_200_OK
assert len(boards.data) == 1

boards = self.http_request(self.user, 'get', 'boards')
(board,) = boards.data

assert boards.data.get('num_items') == 1
assert boards.data.get('results')[0].get('en_name') == 'Free Board'
assert board.get("en_name") == "Free Board"

0 comments on commit 12ded25

Please sign in to comment.