Merge "Added tags controller"
This commit is contained in:
commit
78f934c553
|
@ -117,3 +117,13 @@ class StoriesTestCase(test_base.TestCase):
|
||||||
mock_private_put.assert_called_once_with(
|
mock_private_put.assert_called_once_with(
|
||||||
"/stories/test_story_id/comments/comment_id",
|
"/stories/test_story_id/comments/comment_id",
|
||||||
{"content": "updated_test_comment"})
|
{"content": "updated_test_comment"})
|
||||||
|
|
||||||
|
@mock.patch("storyboardclient.v1.tags.TagsNestedManager._put")
|
||||||
|
def test_stories_update_tags(self, mock_private_put):
|
||||||
|
test_story = stories.Story(mock.MagicMock(),
|
||||||
|
info={"id": "test_story_id"})
|
||||||
|
test_story.tags_manager.update(["first_test_tag", "second_test_tag"])
|
||||||
|
|
||||||
|
mock_private_put.assert_called_once_with(
|
||||||
|
"/stories/test_story_id/tags",
|
||||||
|
["first_test_tag", "second_test_tag"])
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Copyright (c) 2015 Mirantis Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import mock
|
||||||
|
|
||||||
|
from storyboardclient.tests import base as test_base
|
||||||
|
from storyboardclient.v1 import tags
|
||||||
|
|
||||||
|
|
||||||
|
class TagsTestCase(test_base.TestCase):
|
||||||
|
|
||||||
|
@mock.patch("storyboardclient.v1.tags.TagsManager._list")
|
||||||
|
def test_tags_list(self, mock_private_list):
|
||||||
|
tags.TagsManager(mock.MagicMock()).list()
|
||||||
|
mock_private_list.assert_called_once_with(
|
||||||
|
"/tags", None)
|
||||||
|
|
||||||
|
@mock.patch("storyboardclient.v1.tags.TagsManager._post")
|
||||||
|
def test_tags_create(self, mock_private_post):
|
||||||
|
tags.TagsManager(mock.MagicMock()).create(
|
||||||
|
tag_name="test_tag")
|
||||||
|
|
||||||
|
mock_private_post.assert_called_once_with(
|
||||||
|
"/tags",
|
||||||
|
{"tag_name": "test_tag"})
|
|
@ -19,6 +19,7 @@ from storyboardclient.v1 import project_groups
|
||||||
from storyboardclient.v1 import projects
|
from storyboardclient.v1 import projects
|
||||||
from storyboardclient.v1 import stories
|
from storyboardclient.v1 import stories
|
||||||
from storyboardclient.v1 import subscriptions
|
from storyboardclient.v1 import subscriptions
|
||||||
|
from storyboardclient.v1 import tags
|
||||||
from storyboardclient.v1 import tasks
|
from storyboardclient.v1 import tasks
|
||||||
from storyboardclient.v1 import teams
|
from storyboardclient.v1 import teams
|
||||||
from storyboardclient.v1 import users
|
from storyboardclient.v1 import users
|
||||||
|
@ -56,3 +57,4 @@ class Client(base.BaseClient):
|
||||||
self.stories = stories.StoriesManager(self)
|
self.stories = stories.StoriesManager(self)
|
||||||
self.users = users.UsersManager(self)
|
self.users = users.UsersManager(self)
|
||||||
self.subscriptions = subscriptions.SubscriptionsManager(self)
|
self.subscriptions = subscriptions.SubscriptionsManager(self)
|
||||||
|
self.tags = tags.TagsManager(self)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from storyboardclient import base
|
from storyboardclient import base
|
||||||
|
from storyboardclient.v1 import tags as tags_api
|
||||||
from storyboardclient.v1 import tasks
|
from storyboardclient.v1 import tasks
|
||||||
from storyboardclient.v1 import timeline
|
from storyboardclient.v1 import timeline
|
||||||
|
|
||||||
|
@ -24,10 +25,12 @@ class Story(base.BaseObject):
|
||||||
is_bug = None
|
is_bug = None
|
||||||
creator_id = None
|
creator_id = None
|
||||||
status = None
|
status = None
|
||||||
|
tags = None
|
||||||
|
|
||||||
tasks = tasks.TasksNestedManager
|
tasks = tasks.TasksNestedManager
|
||||||
comments = timeline.CommentsNestedManager
|
comments = timeline.CommentsNestedManager
|
||||||
events = timeline.TimeLineEventsNestedManager
|
events = timeline.TimeLineEventsNestedManager
|
||||||
|
tags_manager = tags_api.TagsNestedManager
|
||||||
|
|
||||||
|
|
||||||
class StoriesManager(base.BaseManager):
|
class StoriesManager(base.BaseManager):
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Copyright (c) 2015 Mirantis Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from storyboardclient import base
|
||||||
|
|
||||||
|
|
||||||
|
class Tag(base.BaseObject):
|
||||||
|
name = None
|
||||||
|
|
||||||
|
|
||||||
|
class TagsManager(base.BaseManager):
|
||||||
|
url_key = "tags"
|
||||||
|
resource_class = Tag
|
||||||
|
|
||||||
|
|
||||||
|
class TagsNestedManager(base.BaseNestedManager):
|
||||||
|
parent_url_key = "stories"
|
||||||
|
url_key = "tags"
|
||||||
|
resource_class = Tag
|
||||||
|
|
||||||
|
def update(self, tags):
|
||||||
|
return self._put(self.build_url(), tags)
|
||||||
|
|
||||||
|
def delete(self, tags):
|
||||||
|
return self.client.delete(self.build_url(), json=tags)
|
Loading…
Reference in New Issue