def test_set_project_invalid_project(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
     project = Project()
     project._content['id'] = 5
     with self.assertRaises(TestRailError) as e:
         self.milestone.project = project
     self.assertEqual(str(e.exception),
                      "Project ID '5' was not found")
    def setUp(self):
        self.mock_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": None,
            "id": 2,
            "is_completed": False,
            "name": "Project1",
            "show_announcement": True,
            "url": "http://<server>/index.php?/projects/overview/2",
            "suite_mode": 3
        }]

        ptemp = list()
        for pdata in self.mock_data:
            ptemp.append(Project(pdata))
        self.projects = ProjectContainer(ptemp)
 def test_set_project_empty_project(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
     with self.assertRaises(TestRailError) as e:
         self.milestone.project = Project()
     self.assertEqual(str(e.exception),
                      "Project ID 'None' was not found")
 def test_set_project(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
     self.assertEqual(self.milestone.project.id, 1)
     self.milestone.project = Project(self.mock_project_data[1])
     self.assertEqual(self.milestone._content['project_id'], 2)
     self.assertEqual(self.milestone.project.id, 2)
Beispiel #5
0
    def test_set_project(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

        project = Project(self.mock_project_data[1])
        self.plan.project = project
        self.assertEqual(self.plan.project.id, 99)
    def setUp(self):
        self.mock_data_completed = {
            "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
        }

        self.mock_data_incomplete = {
            "announcement": "..",
            "completed_on": None,
            "id": 1,
            "is_completed": False,
            "name": "Project1",
            "show_announcement": True,
            "url": "http://<server>/index.php?/projects/overview/1",
            "suite_mode": 3
        }
        self.project = Project(self.mock_data_completed)
 def project(self):
     return Project(
         self.api.project_with_id(self._content.get('project_id')))
Beispiel #8
0
 def project(self):
     return Project()
 def test_get_completed_on_not_completed(self):
     project = Project(self.mock_data_incomplete)
     self.assertEqual(project.completed_on, None)
Beispiel #10
0
 def project(self):
     return Project(self._content.get('project_id'))