Added branches controller
Added Branch object and manager. Added field branch_id to Task object. Added field autocreate_branches to Project object. Change-Id: I8eaa42f03663c4e65981129f22eec01f13d4a3f3
This commit is contained in:
parent
4772d5b1db
commit
70aedc6ce3
50
storyboardclient/tests/v1/test_branches.py
Normal file
50
storyboardclient/tests/v1/test_branches.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 branches
|
||||
|
||||
|
||||
class BranchesTestCase(test_base.TestCase):
|
||||
|
||||
@mock.patch("storyboardclient.v1.branches.BranchesManager._list")
|
||||
def test_branches_list(self, mock_private_list):
|
||||
branches.BranchesManager(mock.MagicMock()).list()
|
||||
|
||||
mock_private_list.assert_called_once_with(
|
||||
"/branches", None)
|
||||
|
||||
@mock.patch("storyboardclient.v1.branches.BranchesManager._post")
|
||||
def test_branches_create(self, mock_private_post):
|
||||
branches.BranchesManager(mock.MagicMock()).create(
|
||||
name="test_branch",
|
||||
project_id="test_project_id")
|
||||
|
||||
mock_private_post.assert_called_once_with(
|
||||
"/branches",
|
||||
{"name": "test_branch",
|
||||
"project_id": "test_project_id"})
|
||||
|
||||
@mock.patch("storyboardclient.v1.branches.BranchesManager._put")
|
||||
def test_branches_update(self, mock_private_put):
|
||||
branches.BranchesManager(mock.MagicMock()).update(
|
||||
id="test_branch_id",
|
||||
name="test_branch_updated")
|
||||
|
||||
mock_private_put.assert_called_once_with(
|
||||
"/branches/test_branch_id",
|
||||
{"name": "test_branch_updated"})
|
@ -38,13 +38,15 @@ class TasksTestCase(test_base.TestCase):
|
||||
tasks.TasksManager(mock.MagicMock()).create(
|
||||
title="test_task",
|
||||
story_id="test_story_id",
|
||||
project_id="test_project_id")
|
||||
project_id="test_project_id",
|
||||
branch_id="test_branch_id")
|
||||
|
||||
mock_private_post.assert_called_once_with(
|
||||
"/tasks",
|
||||
{"title": "test_task",
|
||||
"story_id": "test_story_id",
|
||||
"project_id": "test_project_id"})
|
||||
"project_id": "test_project_id",
|
||||
"branch_id": "test_branch_id"})
|
||||
|
||||
@mock.patch("storyboardclient.v1.tasks.TasksManager._put")
|
||||
def test_tasks_update(self, mock_private_put):
|
||||
|
29
storyboardclient/v1/branches.py
Normal file
29
storyboardclient/v1/branches.py
Normal file
@ -0,0 +1,29 @@
|
||||
# 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 Branch(base.BaseObject):
|
||||
name = None
|
||||
project_id = None
|
||||
expired = None
|
||||
expiration_date = None
|
||||
autocreated = None
|
||||
|
||||
|
||||
class BranchesManager(base.BaseManager):
|
||||
url_key = "branches"
|
||||
resource_class = Branch
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from storyboardclient import base
|
||||
from storyboardclient.v1 import branches
|
||||
from storyboardclient.v1 import project_groups
|
||||
from storyboardclient.v1 import projects
|
||||
from storyboardclient.v1 import stories
|
||||
@ -47,6 +48,7 @@ class Client(base.BaseClient):
|
||||
super(Client, self).__init__(api_url=api_url,
|
||||
access_token=access_token)
|
||||
|
||||
self.branches = branches.BranchesManager(self)
|
||||
self.tasks = tasks.TasksManager(self)
|
||||
self.teams = teams.TeamsManager(self)
|
||||
self.projects = projects.ProjectsManager(self)
|
||||
|
@ -20,6 +20,7 @@ class Project(base.BaseObject):
|
||||
name = None
|
||||
description = None
|
||||
is_active = None
|
||||
autocreate_branches = None
|
||||
|
||||
|
||||
class ProjectsManager(base.BaseManager):
|
||||
|
@ -24,6 +24,7 @@ class Task(base.BaseObject):
|
||||
story_id = None
|
||||
project_id = None
|
||||
assignee_id = None
|
||||
branch_id = None
|
||||
priority = None
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user