def test_canAddStatus(self):
     PivotalToJiraStatusMap().addMapping(jira="Closed", pivotal="Accepted")
     jiraStatus = JiraStatus(6, "Closed")
     PivotalToJiraStatusMap().insert(jiraStatus)
     item = JiraTrackerItem()
     statusId = 6
     ticket = JiraTicket()
     ticket.setStatus(statusId)
     status = TrackerItemStatus(ticket)
     item.withStatus(status)
     self.assertEqual(item.status(), status)
     self.assertEqual(item.piecesToUpdate(), [{'id':"status", 'values':['',]},])
     PivotalToJiraStatusMap().reset()
 def update(self, item):
     super(JiraTracker, self).update(item)
     print("Update Jira Ticket:")
     if item.Id() is None:
         print(item.asRemoteItem())
         issue = self.trackerInstance_.createIssue(self.authentication_, item.asRemoteItem())
     else:
         print(item.piecesToUpdate())
         issue = self.trackerInstance_.updateIssue(self.authentication_, item.Id(), item.piecesToUpdate())
     updatedItem = JiraTrackerItem(issue)
     if "status" in str(item.piecesToUpdate()):
         updatedItem.withStatus(item.status())
         updatedItem = JiraTrackerItem(self._ticketWithUpdatedStatusFrom(updatedItem))
     print(item.comments("new"))
     updatedItem.withComments(item.comments("new"))
     # to be fully complete updatedItem also needs exisiting comments - tbd
     return self.updateCommentsFor(updatedItem)
Beispiel #3
0
 def test_canAddStatus(self):
     PivotalToJiraStatusMap().addMapping(jira="Closed", pivotal="Accepted")
     jiraStatus = JiraStatus(6, "Closed")
     PivotalToJiraStatusMap().insert(jiraStatus)
     item = JiraTrackerItem()
     statusId = 6
     ticket = JiraTicket()
     ticket.setStatus(statusId)
     status = TrackerItemStatus(ticket)
     item.withStatus(status)
     self.assertEqual(item.status(), status)
     self.assertEqual(item.piecesToUpdate(), [
         {
             'id': "status",
             'values': [
                 '',
             ]
         },
     ])
     PivotalToJiraStatusMap().reset()
 def update(self, item):
     super(JiraTracker, self).update(item)
     print("Update Jira Ticket:")
     if (item.Id() is None):
         print(item.asRemoteItem())
         issue = self.trackerInstance_.createIssue(self.authentication_,
                                                   item.asRemoteItem())
     else:
         print(item.piecesToUpdate())
         issue = self.trackerInstance_.updateIssue(self.authentication_,
                                                   item.Id(),
                                                   item.piecesToUpdate())
     updatedItem = JiraTrackerItem(issue)
     if "status" in str(item.piecesToUpdate()):
         updatedItem.withStatus(item.status())
         updatedItem = JiraTrackerItem(
             self._ticketWithUpdatedStatusFrom(updatedItem))
     print(item.comments('new'))
     updatedItem.withComments(item.comments('new'))
     # to be fully complete updatedItem also needs exisiting comments - tbd
     return self.updateCommentsFor(updatedItem)
 def test_statusAsPiecesNotAddedWhenTryingToAddDuplicateStatus(self):
     testIssue = mock()
     item = JiraTrackerItem(testIssue)
     duplicateStatus = item.status()
     item.withStatus(duplicateStatus)
     self.assertEqual(item.piecesToUpdate(), [])
Beispiel #6
0
 def test_statusAsPiecesNotAddedWhenTryingToAddDuplicateStatus(self):
     testIssue = mock()
     item = JiraTrackerItem(testIssue)
     duplicateStatus = item.status()
     item.withStatus(duplicateStatus)
     self.assertEqual(item.piecesToUpdate(), [])