-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f21b597
commit cce9839
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import json | ||
|
||
from users.models import CustomUser | ||
|
||
from api.models import * | ||
from api.serializers import * | ||
|
||
from .authBase import AuthBaseTestCase | ||
|
||
|
||
|
||
class BoardTestCase(AuthBaseTestCase): | ||
url = '/api/v1/boards' | ||
|
||
def setUp(self): | ||
super().setUp() # Authenticanting | ||
self.data_project = { | ||
"title": "black mesa", | ||
"description": "particle accelerator", | ||
"creator": self.jefe, | ||
} | ||
self.project = Project.objects.create(**self.data_project) | ||
self.boards = Board.objects.all() | ||
self.board = self.boards[0] | ||
print(self.boards) | ||
print(self.board) | ||
self.data_task = { | ||
"title": "task 1", | ||
"description": "first task", | ||
"priority": 1, | ||
"due_date": "2019-11-11", | ||
"board": self.board, | ||
} | ||
self.task = Task.objects.create(**self.data_task) | ||
self.data_task['board'] = self.board.id | ||
|
||
|
||
def test_read_board_get(self): | ||
""" | ||
Test to verify GET board valid (Model and Serializer) | ||
""" | ||
url = self.url + '?project={id}'.format(id=self.project.id) | ||
response = self.client.get(url) | ||
print(response.status_code, response.content) | ||
self.assertEqual(200, response.status_code) | ||
response_data = json.loads(response.content) | ||
print(response_data) | ||
boardSerial = BoardSerializer(instance=self.board) | ||
boardsSerial= [BoardSerializer(instance=x).data for x in self.boards] | ||
print(boardSerial.data) | ||
print(boardsSerial) | ||
self.assertEqual(boardsSerial, response_data['results']) |