diff --git a/storyboardclient/tests/v1/test_milestones.py b/storyboardclient/tests/v1/test_milestones.py new file mode 100644 index 0000000..28a7a19 --- /dev/null +++ b/storyboardclient/tests/v1/test_milestones.py @@ -0,0 +1,50 @@ +# 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 milestones + + +class MilestonesTestCase(test_base.TestCase): + + @mock.patch("storyboardclient.v1.milestones.MilestonesManager._list") + def test_milestones_list(self, mock_private_list): + milestones.MilestonesManager(mock.MagicMock()).list() + + mock_private_list.assert_called_once_with( + "/milestones", None) + + @mock.patch("storyboardclient.v1.milestones.MilestonesManager._post") + def test_milestones_create(self, mock_private_post): + milestones.MilestonesManager(mock.MagicMock()).create( + name="test_milestone", + branch_id="test_branch_id") + + mock_private_post.assert_called_once_with( + "/milestones", + {"name": "test_milestone", + "branch_id": "test_branch_id"}) + + @mock.patch("storyboardclient.v1.milestones.MilestonesManager._put") + def test_milestones_update(self, mock_private_put): + milestones.MilestonesManager(mock.MagicMock()).update( + id="test_milestone_id", + name="test_milestone_updated") + + mock_private_put.assert_called_once_with( + "/milestones/test_milestone_id", + {"name": "test_milestone_updated"}) diff --git a/storyboardclient/v1/client.py b/storyboardclient/v1/client.py index 055ff78..01aaff7 100644 --- a/storyboardclient/v1/client.py +++ b/storyboardclient/v1/client.py @@ -15,6 +15,7 @@ from storyboardclient import base from storyboardclient.v1 import branches +from storyboardclient.v1 import milestones from storyboardclient.v1 import project_groups from storyboardclient.v1 import projects from storyboardclient.v1 import stories @@ -58,3 +59,4 @@ class Client(base.BaseClient): self.users = users.UsersManager(self) self.subscriptions = subscriptions.SubscriptionsManager(self) self.tags = tags.TagsManager(self) + self.milestones = milestones.MilestonesManager(self) diff --git a/storyboardclient/v1/milestones.py b/storyboardclient/v1/milestones.py new file mode 100644 index 0000000..a619089 --- /dev/null +++ b/storyboardclient/v1/milestones.py @@ -0,0 +1,28 @@ +# 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 Milestone(base.BaseObject): + name = None + branch_id = None + expired = None + expiration_date = None + + +class MilestonesManager(base.BaseManager): + url_key = "milestones" + resource_class = Milestone \ No newline at end of file diff --git a/storyboardclient/v1/tasks.py b/storyboardclient/v1/tasks.py index d7e4e1e..cd6557b 100644 --- a/storyboardclient/v1/tasks.py +++ b/storyboardclient/v1/tasks.py @@ -25,6 +25,7 @@ class Task(base.BaseObject): project_id = None assignee_id = None branch_id = None + milestone_id = None priority = None