Пример #1
0
 def test_create_ticket_request_id(self, mock_session, mock_project, mock_content):
     mock_session.return_value = FakeSession(status_code=204)
     ticket = bugzilla.BugzillaTicket(URL, PROJECT)
     with patch.object(bugzilla.BugzillaTicket, '_generate_ticket_url') as mock_url:
         t = ticket._create_ticket_request({})
     self.assertEqual(ticket.ticket_id, TICKET_ID2)
     self.assertEqual(ticket.ticket_url, mock_url.return_value)
     self.assertEqual(t, mock_content.return_value)
Пример #2
0
 def test_create_ticket_request_unexpected_response(self, mock_session, mock_id, mock_project):
     mock_session.return_value = FakeSession(status_code=400)
     ticket = bugzilla.BugzillaTicket(URL, PROJECT)
     t = ticket._create_ticket_request({})
     self.assertEqual(t, FAILURE_RESULT._replace(error_message=''))
Пример #3
0
 def test_create_ticket_request_else(self, mock_session):
     mock_session.return_value = FakeSession()
     error_message = 'Error creating ticket'
     ticket = bugzilla.BugzillaTicket(URL, PROJECT)
     t = ticket._create_ticket_request({})
     self.assertEqual(t, FAILURE_RESULT._replace(error_message=error_message))
Пример #4
0
 def test_create_ticket_request_error(self, mock_session):
     mock_session.return_value = FakeSession(status_code=401)
     error_message = 'There is some error.'
     ticket = bugzilla.BugzillaTicket(URL, PROJECT)
     t = ticket._create_ticket_request({})
     self.assertEqual(t, FAILURE_RESULT._replace(error_message=error_message))