예제 #1
0
 def test_set_assigned_to_invalid_user(self, mock_get):
     mock_response = mock.Mock()
     mock_response.json.return_value = copy.deepcopy(self.mock_user_data)
     mock_response.status_code = 200
     mock_get.return_value = mock_response
     user = User()
     user._content['id'] = 5
     with self.assertRaises(TestRailError) as e:
         self.result.assigned_to = user
     self.assertEqual(str(e.exception),
                      "User with ID '%s' is not valid" % user.id)
예제 #2
0
    def setUp(self):
        self.mock_user_data = {
            "email": "*****@*****.**",
            "id": 1,
            "is_active": True,
            "name": "Han Solo"}

        self.user = User(self.mock_user_data)
예제 #3
0
 def test_set_assigned_to(self, mock_get):
     mock_response = mock.Mock()
     mock_response.json.return_value = copy.deepcopy(self.mock_user_data)
     mock_response.status_code = 200
     mock_get.return_value = mock_response
     user = User(self.mock_user_data[1])
     self.assertEqual(self.result.assigned_to.id, 1)
     self.result.assigned_to = user
     self.assertEqual(self.result._content['assignedto_id'], 2)
     self.assertEqual(self.result.assigned_to.id, 2)
예제 #4
0
 def test_plancontainer_created_by(self, mock_get):
     API.flush_cache()
     mock_response = mock.Mock()
     mock_response.json.side_effect = [
         self.mock_plans_data, self.mock_users
     ]
     mock_response.status_code = 200
     mock_get.return_value = mock_response
     user = User({'id': 3})
     created_by = self.client.plans().created_by(user)
     self.assertTrue([lambda x: isinstance(x, Plan) for x in created_by])
     self.assertEqual(len(created_by), 2)
     self.assertEqual(created_by[0].id, 33)
     self.assertEqual(created_by[1].id, 44)
예제 #5
0
 def user(self):
     return User()
예제 #6
0
 def created_by(self):
     user_id = self._content.get('created_by')
     return User(self.api.user_by_id(user_id))
예제 #7
0
 def assigned_to(self):
     return User(self.api.user_with_id(self._content.get('assignedto_id')))
예제 #8
0
 def created_by(self):
     return User(self.api.user_with_id(self._content.get('created_by')))
예제 #9
0
 def assigned_to(self):
     user_id = self._content.get('assignedto_id')
     return User(self.api.user_with_id(user_id)) if user_id else User()