def itemWithCommentsOfType(self, CommentType, ItemType, issue):
     comment1 = TrackerItemComment("comment1")
     comment2 = TrackerItemComment("comment2")
     item = ItemType(issue)
     item.addComment(CommentType(comment1))
     item.addComment(CommentType(comment2))
     self.issue = issue
     self.comment1 = comment1
     self.comment2 = comment2
     return item
    def test_whenTicketNumberInCommentsOfOtherTickerTheRightSyncOccurs(self):
        jira = self.jira_
        pivotal = self.pivotal_
        desiredSummary = "test_whenTicketNumberInCommentsOfOtherTickerTheRightSyncOccurs-1"
        desiredDescription = "overwritten!"
        newJiraItem = jiraItemFactory(Env().get("jira", "project"),
                                      "to be overwritten", "also overwritten")
        self.syncNewItemToPivotal(newJiraItem, jira, pivotal)
        jiraItem = next(jira.items())

        newJiraItem = jiraItemFactory(
            Env().get("jira", "project"),
            "test_whenTicketNumberInCommentsOfOtherTickerTheRightSyncOccurs-2",
            "don't overwrite")
        newJiraItem.addComment(TrackerItemComment(jiraItem.Id()))
        self.syncNewItemToPivotal(newJiraItem, jira, pivotal)

        for item in jira.items():
            jiraItem = item

        jiraItem.withDescription(desiredDescription)
        jiraItem.withSummary(desiredSummary)
        jira.update(jiraItem)

        syncItem = TrackerSyncBy.syncingItem()
        for item in jira.items():
            syncItem(item, toTracker=pivotal)

        for item in pivotal.items():
            updatedPivotalItem = item

        self.assertEqual(updatedPivotalItem.summary(), desiredSummary)
        self.assertEqual(updatedPivotalItem.description(), desiredDescription)
        pass
 def test_20000PlusCharacterCommentsAreNotSyned(self):
     jira = self.jira_
     pivotal = self.pivotal_
     newJiraItem = jiraItemFactory(
         Env().get("jira", "project"),
         "test_20000PlusCharacterCommentsAreNotSyned", "blah")
     commentOnJira = TrackerItemComment(Testing.stringOfAsOfSize(20002))
     newJiraItem.addComment(commentOnJira)
     self.syncNewItemToPivotal(newJiraItem, jira, pivotal)
     pivotalItem = next(pivotal.items())
     self.assertEqual(len(pivotalItem.comments()), 0)
 def test_commentOnIssueInJiraIsSyncedToPivotal(self):
     jira = self.jira_
     pivotal = self.pivotal_
     newJiraItem = jiraItemFactory(Env().get("jira", "project"),
                                   "to test comments", "blah")
     self.syncNewItemToPivotal(newJiraItem, jira, pivotal)
     commentOnJira = TrackerItemComment("this commentOnJira can be synced")
     jiraItem = next(jira.items())
     jiraItem.addComment(commentOnJira)
     jira.update(jiraItem)
     self.syncExistingItemFrom(jira, pivotal)
     updatedPivotalItem = next(pivotal.items())
     self.assertEqual(updatedPivotalItem.comments()[0], commentOnJira)
     pass
 def test_baseForPivotalIsNone(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     self.assertEqual(comment.forPivotal(), None)
 def test_commentNotEqaulsOther(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     otherText = "other"
     other = TrackerItemComment(otherText)
     self.assertNotEqual(comment, other)
 def test_commentEqualsSelf(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     self.assertEqual(comment, comment)
 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_canGetJiraDictionay(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     jiraComment = JiraComment(comment)
     self.assertDictEqual(jiraComment.forJira(), {'body': setText})
 def test_canGetTextForTrackerItemComment(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     self.assertEqual(comment.text(), setText)
 def test_baseForPivotalIsNone(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     self.assertEqual(comment.forPivotal(), None)
 def test_canGetTextForTrackerItemComment(self):
     setText = "blah"
     comment = TrackerItemComment(setText)
     self.assertEqual(comment.text(), setText)