def test_canGetCommentsForTicket(self):
     jira = JiraTracker()
     jiraInstance = self.getMockFor(jira)
     ticket = mock()
     key = "12345"
     twoComments = [RemoteComment("comment0"), RemoteComment("comment1")]        
     when(ticket).Id().thenReturn(key)
     when(jiraInstance.service).getComments(any(),any()).thenReturn(twoComments)
     jira.addCommentsTo(ticket)
     verify(jiraInstance.service).getComments(self.auth_, key)
     inorder.verify(ticket).Id()
     inorder.verify(ticket).addComment(JiraComment(twoComments[0]), 'existing')
     inorder.verify(ticket).addComment(JiraComment(twoComments[1]), 'existing')
     pass
 def addCommentsTo(self, item):
     comments = self.trackerInstance_.getComments(self.authentication_,
                                                  item.Id())
     if comments is not None:
         for comment in comments:
             item.addComment(JiraComment(comment), 'existing')
     return item
 def test_canCheckInequality(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     remoteComment = RemoteComment()
     another = JiraComment(remoteComment)
     self.assertNotEqual(comment, another)
 def test_canCheckEquality(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     another = JiraComment(comment)
     self.assertEqual(comment, another)
 def test_canGetTextFromRemoteComment(self):
     remoteComment = RemoteComment()
     comment = JiraComment(remoteComment)
     self.assertEqual(comment.text(), remoteComment.body)
 def test_canGetJiraDictionay(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     jiraComment = JiraComment(comment)
     self.assertDictEqual(jiraComment.forJira(), {'body': setText})
 def test_canGetTextFromRemoteComment(self):
     remoteComment = RemoteComment()
     comment = JiraComment(remoteComment)
     self.assertEqual(comment.text(), remoteComment.body)
 def test_canGetJiraDictionay(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     jiraComment = JiraComment(comment)
     self.assertDictEqual(jiraComment.forJira(), {'body':setText})