def setUp(self): super(MilestonesTest, self).setUp() self.milestone_01 = { 'name': u'test_milestone', 'branch_id': 1 } self.branch_01 = { 'name': u'test_branch', 'project_id': 1 } self.project_01 = { 'name': u'TestProject', 'description': u'TestDescription' } projects.project_create(self.project_01) branches.branch_create(self.branch_01)
def post(self, branch): """Create a new branch. :param branch: A branch within the request body. """ branch_dict = branch.as_dict() # we can't create expired branch if branch.expiration_date or branch.expired: abort(400, _("Can't create expired branch.")) result = branches_api.branch_create(branch_dict) return wmodels.Branch.from_db_model(result)
def project_create(values): # Create project and 'master' branch for him project = api_base.entity_create(models.Project, values) master_branch = MasterBranchHelper(project["id"]) branches_api.branch_create(master_branch.as_dict()) return project