-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #627 from bounswe/smtag-api
User can add SM Tag
- Loading branch information
Showing
3 changed files
with
51 additions
and
3 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 |
---|---|---|
|
@@ -969,6 +969,7 @@ def test_no_context_given(self): | |
|
||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
|
||
|
||
def test_user_conversion(self): | ||
url = reverse('promote_contributor') | ||
data = {'cont_id': self.contributor.id} | ||
|
@@ -990,3 +991,25 @@ def test_user_conversion(self): | |
response = self.client.delete(f'{url}?reviewer_id={self.contributor.id}') | ||
self.assertEqual(response.status_code, 404) | ||
|
||
class AddUserSemanticTagTestCase(TestCase): | ||
def setUp(self): | ||
self.client = APIClient() | ||
self.user = User.objects.create_user(id=1, email='[email protected]', username='[email protected]', first_name='User', | ||
last_name='Test') | ||
self.basic_user = BasicUser.objects.create(user=self.user, bio='Hello') | ||
|
||
self.basic_user_token = Token.objects.create(user=self.user) | ||
|
||
self.client.credentials(HTTP_AUTHORIZATION=f"Token {self.basic_user_token.key}") | ||
|
||
self.sm_tag = SemanticTag.objects.create( | ||
wid="QXXX", | ||
label="Test SM Tag" | ||
) | ||
def test_add_user_semantic_tag(self): | ||
url = reverse('add_user_semantic_tag') | ||
payload = { | ||
'sm_tag_id': self.sm_tag.pk, | ||
} | ||
response = self.client.post(url, payload, format='json') | ||
self.assertEqual(response.status_code, status.HTTP_201_CREATED) |
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