-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Interview to v2 api (read only for now) [#184870683] (#639)
* add Interview GET to v2 api [#184870683] * fix azure issue with lxml>=5.0
- Loading branch information
1 parent
800147b
commit 96f61d7
Showing
11 changed files
with
198 additions
and
36 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,46 @@ | ||
import random | ||
|
||
from tests import randgen | ||
from tests.util import APITestCase | ||
from tracker.api.serializers import InterviewSerializer | ||
|
||
|
||
class TestInterviews(APITestCase): | ||
model_name = 'interview' | ||
serializer_class = InterviewSerializer | ||
rand = random.Random() | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self.run = randgen.generate_run(self.rand, event=self.event, ordered=True) | ||
self.run.save() | ||
self.public_interview = randgen.generate_interview(self.rand, run=self.run) | ||
self.public_interview.save() | ||
self.private_interview = randgen.generate_interview(self.rand, run=self.run) | ||
self.private_interview.public = False | ||
self.private_interview.save() | ||
|
||
def test_public_fetch(self): | ||
data = self.get_detail(self.public_interview) | ||
self.assertV2ModelPresent(self.public_interview, data) | ||
|
||
def test_private_fetch(self): | ||
self.get_detail(self.private_interview, status_code=404) | ||
|
||
self.client.force_authenticate(self.view_user) | ||
|
||
data = self.get_detail(self.private_interview) | ||
self.assertV2ModelPresent(self.private_interview, data) | ||
|
||
def test_public_list(self): | ||
data = self.get_list()['results'] | ||
self.assertV2ModelPresent(self.public_interview, data) | ||
self.assertV2ModelNotPresent(self.private_interview, data) | ||
|
||
def test_private_list(self): | ||
self.get_list(data={'all': ''}, status_code=403) | ||
|
||
self.client.force_authenticate(self.view_user) | ||
data = self.get_list(data={'all': ''})['results'] | ||
self.assertV2ModelPresent(self.public_interview, data) | ||
self.assertV2ModelPresent(self.private_interview, data) |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.