예제 #1
0
 def milestone(self):
     milestone_id = self._content.get('milestone_id')
     if milestone_id is None:
         return Milestone()
     return Milestone(
         self.api.milestone_with_id(milestone_id,
                                    self._content.get('project_id')))
예제 #2
0
    def test_set_milestone(self, mock_get):
        mock_response = mock.Mock()
        mock_response.json.return_value = copy.deepcopy(self.mock_project_data)
        mock_response.status_code = 200
        mock_get.return_value = mock_response

        milestone = Milestone(self.mock_mstone_data[1])
        self.plan.milestone = milestone
        self.assertEqual(self.plan._content['milestone_id'], 7)
예제 #3
0
    def test_set_milestone(self, mock_get, refresh_mock):
        refresh_mock.return_value = True
        mock_response = mock.Mock()
        mock_response.json.return_value = copy.deepcopy(self.mock_mstone_data)
        mock_response.status_code = 200
        mock_get.return_value = mock_response

        mstone = Milestone(self.mock_mstone_data[0])
        self.run.milestone = mstone
        self.assertEqual(self.run.milestone.id, 9)
예제 #4
0
 def test_plancontainer_for_milestone(self, mock_get):
     mock_response = mock.Mock()
     mock_response.json.side_effect = [
         filter(lambda x: x['milestone_id'] == 1, self.mock_plans_data),
         self.mock_milestone_data
     ]
     mock_response.status_code = 200
     mock_get.return_value = mock_response
     milestone = Milestone(self.mock_milestone_data[0])
     plans = self.client.plans(milestone)
     self.assertTrue(isinstance(plans, PlanContainer))
     self.assertTrue([isinstance(p, Plan) for p in plans])
     self.assertTrue([p._content['milestone_id'] == 1 for p in plans])
    def setUp(self):
        self.mock_milestone_data = {
            "completed_on": 1389968184,
            "description": "foo",
            "due_on": 1391968184,
            "id": 1,
            "is_completed": True,
            "name": "Release 1.5",
            "project_id": 1,
            "url": "http://<server>/index.php?/milestones/view/1"
        }

        self.mock_project_data = [
            {
                "announcement": "..",
                "completed_on": 1453504099,
                "id": 1,
                "is_completed": True,
                "name": "Project1",
                "show_announcement": True,
                "url": "http://<server>/index.php?/projects/overview/1",
                "suite_mode": 3
            },
            {
                "announcement": "..",
                "completed_on": 1453504099,
                "id": 2,
                "is_completed": True,
                "name": "Project2",
                "show_announcement": True,
                "url": "http://<server>/index.php?/projects/overview/1",
                "suite_mode": 3
            }
        ]

        self.milestone = Milestone(self.mock_milestone_data)
예제 #6
0
 def _update_milestone(self, obj):
     return Milestone(self.api.update_milestone(obj.raw_data()))
예제 #7
0
 def _add_milestone(self, obj):
     obj.project = obj.project or self.project(self._project_id)
     return Milestone(self.api.add_milestone(obj.raw_data()))
예제 #8
0
 def milestone(self):
     return Milestone()
예제 #9
0
 def milestone(self):
     m = self.api.milestone_with_id(self._content.get('milestone_id'))
     return Milestone(m) if m else Milestone()
예제 #10
0
 def test_get_due_on_none(self):
     milestone = Milestone({})
     self.assertEqual(milestone.due_on, None)
예제 #11
0
 def test_get_completed_on_not_completed(self):
     milestone = Milestone({})
     self.assertEqual(milestone.completed_on, None)