Skip to content

Commit fdb6723

Browse files
committed
Merge branch 'master' of https://github.com/biocore/qiita into listing-tags
2 parents 2369a5e + d3555ac commit fdb6723

File tree

5 files changed

+36
-7
lines changed

5 files changed

+36
-7
lines changed

qiita_db/study.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ def unshare(self, user):
11371137
qdb.sql_connection.TRN.add(sql, [self._id, user.id])
11381138
qdb.sql_connection.TRN.execute()
11391139

1140-
def updata_tags(self, user, tags):
1140+
def update_tags(self, user, tags):
11411141
"""Sets the tags of the study
11421142
11431143
Parameters

qiita_db/test/test_study.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,19 +855,19 @@ def test_study_tags(self):
855855
# assigning the tags to study as user
856856
study = qdb.study.Study(1)
857857
tags = ['this is my tag', 'actual GOLD!']
858-
message = study.updata_tags(user, tags)
858+
message = study.update_tags(user, tags)
859859
self.assertItemsEqual(study.tags, tags[:1])
860860
self.assertEqual(message, 'Only admins can assign: actual GOLD!')
861861
# now like admin
862-
message = study.updata_tags(admin, tags)
862+
message = study.update_tags(admin, tags)
863863
self.assertItemsEqual(study.tags, tags)
864864
self.assertEqual(message, '')
865865

866866
# cleaning tags
867-
message = study.updata_tags(user, [])
867+
message = study.update_tags(user, [])
868868
self.assertEqual(study.tags, ['actual GOLD!'])
869869
self.assertEqual(message, 'You cannot remove: actual GOLD!')
870-
message = study.updata_tags(admin, [])
870+
message = study.update_tags(admin, [])
871871
self.assertEqual(study.tags, [])
872872
self.assertEqual(message, '')
873873

qiita_pet/handlers/api_proxy/studies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def study_tags_patch_request(user_id, study_id,
384384
study = Study(study_id)
385385

386386
if attribute == 'tags':
387-
message = study.updata_tags(User(user_id), req_value)
387+
message = study.update_tags(User(user_id), req_value)
388388
return {'status': 'success',
389389
'message': message}
390390
else:

qiita_pet/handlers/study_handlers/tests/test_base.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,29 @@ def test_get(self):
7575
self.assertEqual(response.code, 200)
7676
self.assertEqual(response.body, exp)
7777

78+
# test error
79+
response = self.get('/study/tags/bla')
80+
self.assertEqual(response.code, 400)
81+
7882
def test_patch(self):
7983
arguments = {'op': 'replace', 'path': '/tags',
8084
'value[]': "['testA', 'testB']"}
8185
obs = self.patch('/study/tags/1', headers=self.header, data=arguments)
8286

8387
self.assertEqual(obs.code, 200)
8488
self.assertEqual(obs.body, '{"status": "success", "message": ""}')
85-
8689
# checking the tags were added
8790
response = self.get('/study/tags/1')
8891
exp = ('{"status": "success", "message": "", "tags": '
8992
'["[\'testA\', \'testB\']"]}')
9093
self.assertEqual(response.code, 200)
9194
self.assertEqual(response.body, exp)
9295

96+
arguments = {'op': 'replace', 'path': '/tags',
97+
'value[]': "['testA', 'testB']"}
98+
obs = self.patch('/study/tags/b', headers=self.header, data=arguments)
99+
self.assertEqual(obs.code, 400)
100+
93101

94102
if __name__ == "__main__":
95103
main()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2011-2014 Twitter, Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)