Added milestones controller
Added Milestone object and manager. Added field milestone_id to Task object. Change-Id: I87347e99f95b49a580cf0e34ed968d4b4e77853b
This commit is contained in:
		
							
								
								
									
										50
									
								
								storyboardclient/tests/v1/test_milestones.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								storyboardclient/tests/v1/test_milestones.py
									
									
									
									
									
										Normal file
									
								
							| @@ -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"}) | ||||||
| @@ -15,6 +15,7 @@ | |||||||
|  |  | ||||||
| from storyboardclient import base | from storyboardclient import base | ||||||
| from storyboardclient.v1 import branches | from storyboardclient.v1 import branches | ||||||
|  | from storyboardclient.v1 import milestones | ||||||
| from storyboardclient.v1 import project_groups | 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 | ||||||
| @@ -58,3 +59,4 @@ class Client(base.BaseClient): | |||||||
|         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) |         self.tags = tags.TagsManager(self) | ||||||
|  |         self.milestones = milestones.MilestonesManager(self) | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								storyboardclient/v1/milestones.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								storyboardclient/v1/milestones.py
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
| @@ -25,6 +25,7 @@ class Task(base.BaseObject): | |||||||
|     project_id = None |     project_id = None | ||||||
|     assignee_id = None |     assignee_id = None | ||||||
|     branch_id = None |     branch_id = None | ||||||
|  |     milestone_id = None | ||||||
|     priority = None |     priority = None | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Aleksey Ripinen
					Aleksey Ripinen