コード例 #1
0
 def test_canSyncType(self):
     type = "A Type"
     typeB = "B Type"
     item1 = TrackerItem().withType(type)
     item2 = TrackerItem().withType(typeB)
     item2.syncWith(item1)
     self.assertEqual(type, item2.type())
コード例 #2
0
 def test_canSyncOwner(self):
     userA = BaseUser()
     userB = BaseUser()
     item1 = TrackerItem().withOwner(userA)
     item2 = TrackerItem().withOwner(userB)
     item2.syncWith(item1)
     syncedUser = item2.owner()
     self.assertTrue(syncedUser is userA)
コード例 #3
0
 def test_canSyncReporter(self):
     userA = BaseUser()
     userB = BaseUser()
     item1 = TrackerItem().withRequestor(userA)
     item2 = TrackerItem().withRequestor(userB)
     item2.syncWith(item1)
     syncedUser = item2.requestor()
     self.assertTrue(syncedUser is userA)
コード例 #4
0
 def test_canSyncStatus(self):
     statusA = TrackerItemStatus()
     statusB = TrackerItemStatus()
     item1 = TrackerItem().withStatus(statusA)
     item2 = TrackerItem().withStatus(statusB)
     item2.syncWith(item1)
     syncedStatus = item2.status()
     self.assertTrue(syncedStatus is statusA)
コード例 #5
0
 def test_duplicateCommentIsNotAdded(self):
     item = TrackerItem()
     comment1 = "Don't duplicate me"
     item.addComment(comment1, 'existing')
     item.addComment(comment1, 'existing')
     item.addComment(comment1, 'new')
     self.assertEqual(len(item.comments('new')), 0)
     self.assertEqual(len(item.comments('existing')), 1)
コード例 #6
0
 def test_canSyncCommentsWithItem(self):
     commentsToSync = ["check for this"]
     commentsSeed = ["existing comment"]
     itemTarget = TrackerItem().withComments(commentsSeed, 'existing')
     itemSource = TrackerItem().withComments(commentsToSync, 'existing')
     itemTarget.syncWith(itemSource)
     self.assertEqual(len(itemTarget.comments('existing')), 1)
     self.assertEqual(len(itemTarget.comments('new')), 1)
     self.assertEqual(itemTarget.comments('new'), commentsToSync)
コード例 #7
0
 def test_duplicateCommentIsNotAdded(self):
     item = TrackerItem()
     comment1 = "Don't duplicate me"
     item.addComment(comment1, 'existing')
     item.addComment(comment1, 'existing')
     item.addComment(comment1, 'new')
     self.assertEqual(len(item.comments('new')), 0)
     self.assertEqual(len(item.comments('existing')), 1)
コード例 #8
0
    def test_canGetUtcTime(self):
        class testing(object):
            def __init__(self, mocking):
                self.mocking_ = mocking

            def __add__(self, other):
                return self.mocking_.add(other)

            def utcoffset(self):
                return self.mocking_.utcoffset()

        item = TrackerItem()
        dateTime = mock()
        testDateTime = testing(dateTime)
        deltaTime = mock()
        finalTime = mock()
        when(dateTime).utcoffset().thenReturn(deltaTime)
        when(dateTime).add(deltaTime).thenReturn(finalTime)
        when(finalTime).replace(tzinfo=None).thenReturn(1)
        newDateTime = item._convertToUtc(testDateTime)
        self.assertEqual(newDateTime, 1)
コード例 #9
0
 def test_canGetUtcTime(self):
     class testing(object):
         def __init__(self, mocking):
             self.mocking_ = mocking
         
         def __add__(self, other):
             return self.mocking_.add(other)
         
         def utcoffset(self):
             return self.mocking_.utcoffset()
             
     item = TrackerItem()
     dateTime = mock()
     testDateTime = testing(dateTime)
     deltaTime = mock()
     finalTime = mock()
     when(dateTime).utcoffset().thenReturn(deltaTime)
     when(dateTime).add(deltaTime).thenReturn(finalTime)
     when(finalTime).replace(tzinfo=None).thenReturn(1)
     newDateTime = item._convertToUtc(testDateTime)
     self.assertEqual(newDateTime, 1)  
コード例 #10
0
 def test_canSyncType(self):
     type = "A Type"
     typeB = "B Type"
     item1 = TrackerItem().withType(type)
     item2 = TrackerItem().withType(typeB)
     item2.syncWith(item1)
     self.assertEqual(type, item2.type())
コード例 #11
0
 def test_canSyncStatus(self):
     statusA = TrackerItemStatus()
     statusB = TrackerItemStatus()
     item1 = TrackerItem().withStatus(statusA)
     item2 = TrackerItem().withStatus(statusB)
     item2.syncWith(item1)
     syncedStatus = item2.status()
     self.assertTrue(syncedStatus is statusA)
コード例 #12
0
 def test_canSyncReporter(self):
     userA = BaseUser()
     userB = BaseUser()
     item1 = TrackerItem().withRequestor(userA)
     item2 = TrackerItem().withRequestor(userB)
     item2.syncWith(item1)
     syncedUser = item2.requestor()
     self.assertTrue(syncedUser is userA)
コード例 #13
0
 def test_canSyncOwner(self):
     userA = BaseUser()
     userB = BaseUser()
     item1 = TrackerItem().withOwner(userA)
     item2 = TrackerItem().withOwner(userB)
     item2.syncWith(item1)
     syncedUser = item2.owner()
     self.assertTrue(syncedUser is userA)
コード例 #14
0
 def test_canSyncCommentsWithItem(self):
     commentsToSync = ["check for this"]
     commentsSeed = ["existing comment"]
     itemTarget = TrackerItem().withComments(commentsSeed, 'existing')
     itemSource = TrackerItem().withComments(commentsToSync, 'existing')
     itemTarget.syncWith(itemSource)
     self.assertEqual(len(itemTarget.comments('existing')), 1)
     self.assertEqual(len(itemTarget.comments('new')), 1)
     self.assertEqual(itemTarget.comments('new'), commentsToSync)
コード例 #15
0
 def test_canAddOwner(self):
     item = TrackerItem()
     owner = "me"
     item.withOwner(owner)
     self.assertEqual(owner, item.owner())
コード例 #16
0
 def test_canAddRequestor(self):
     item = TrackerItem()
     requestor = "me"
     item.withRequestor(requestor)
     self.assertEqual(requestor, item.requestor())
コード例 #17
0
 def test_canAddOwner(self):
     item = TrackerItem()
     owner = "me"
     item.withOwner(owner)
     self.assertEqual(owner, item.owner())
コード例 #18
0
 def test_canAddExistingComment(self):
     existingComment = {'id':1, 'text':"existing comment"}
     item = TrackerItem()
     item.addComment(existingComment, "existing")
     self.assertEqual(item.comments()[0], existingComment)
コード例 #19
0
 def test_canConstructTestItem(self):
     item = TrackerItem()
     self.assertEqual(type(item), TrackerItem)
     pass
コード例 #20
0
 def test_canMethodChainSummary(self):
     item = TrackerItem().withSummary("blah")
     self.assertEqual(item.summary(), "blah")
コード例 #21
0
 def test_canGetId(self):
     item = TrackerItem()
     self.assertEqual(item.Id(), None)
コード例 #22
0
 def test_syncItemSpecificData(self):
     otherItem = mock()
     thisItem = TrackerItem()
     when(otherItem).comments().thenReturn([])
     thisItem.syncWith(otherItem)
     verify(otherItem).copyTypeSpecificDataTo(thisItem)
コード例 #23
0
 def test_canAddType(self):
     item = TrackerItem()
     type = "A Type"
     item.withType(type)
     self.assertEqual(type, item.type())
コード例 #24
0
 def test_canAddExistingComment(self):
     existingComment = {'id': 1, 'text': "existing comment"}
     item = TrackerItem()
     item.addComment(existingComment, "existing")
     self.assertEqual(item.comments()[0], existingComment)
コード例 #25
0
 def test_canSyncSummaryWithItem(self):
     summaryToSync = "Check for this"
     item1 = TrackerItem().withSummary("summary")
     item2 = TrackerItem().withSummary(summaryToSync)
     item1.syncWith(item2)
     self.assertEqual(item1.summary(), summaryToSync)
コード例 #26
0
 def test_canSyncDescriptionWithItem(self):
     descriptionToSync = "Check for this"
     item1 = TrackerItem().withDescription("summary")
     item2 = TrackerItem().withDescription(descriptionToSync)
     item1.syncWith(item2)
     self.assertEqual(item1.description(), descriptionToSync)
コード例 #27
0
 def test_canSyncDescriptionWithItem(self):
     descriptionToSync = "Check for this"
     item1 = TrackerItem().withDescription("summary")
     item2 = TrackerItem().withDescription(descriptionToSync)
     item1.syncWith(item2)
     self.assertEqual(item1.description(), descriptionToSync)
コード例 #28
0
 def test_canCopyNewComments(self):
     item = TrackerItem()
     commentsToCopy = ["comment1", "comment2"]
     item.withComments(commentsToCopy)
     self.assertEqual(item.comments('new'), commentsToCopy)
コード例 #29
0
 def test_canAddRequestor(self):
     item = TrackerItem()
     requestor = "me"
     item.withRequestor(requestor)
     self.assertEqual(requestor, item.requestor())
コード例 #30
0
 def test_canAddDescription(self):
     item = TrackerItem()
     description = "test"
     item.withDescription(description)
     self.assertEqual(item.description(), description)
コード例 #31
0
 def test_canAddSummary(self):
     item = TrackerItem()
     summary = "test"
     item.withSummary(summary)
     self.assertEqual(item.summary(), summary)
コード例 #32
0
 def test_canMethodChainSummary(self):
     item = TrackerItem().withSummary("blah")
     self.assertEqual(item.summary(), "blah")
コード例 #33
0
 def test_canAddDescription(self):
     item = TrackerItem()
     description = "test"
     item.withDescription(description)
     self.assertEqual(item.description(), description)
コード例 #34
0
 def test_canAddSummary(self):
     item = TrackerItem()
     summary = "test"
     item.withSummary(summary)
     self.assertEqual(item.summary(), summary)
コード例 #35
0
 def test_canSyncSummaryWithItem(self):
     summaryToSync = "Check for this"
     item1 = TrackerItem().withSummary("summary")
     item2 = TrackerItem().withSummary(summaryToSync)
     item1.syncWith(item2)
     self.assertEqual(item1.summary(), summaryToSync)
コード例 #36
0
 def test_canAddNewComment(self):
     newComment = "new Comment"
     item = TrackerItem()
     item.addComment(newComment)
     self.assertEqual(item.comments('new')[0], newComment)
コード例 #37
0
 def test_canAddNewComment(self):
     newComment = "new Comment"
     item = TrackerItem()
     item.addComment(newComment)
     self.assertEqual(item.comments('new')[0], newComment)
コード例 #38
0
 def test_syncItemSpecificData(self):
     otherItem = mock()
     thisItem = TrackerItem()
     when(otherItem).comments().thenReturn([])
     thisItem.syncWith(otherItem)
     verify(otherItem).copyTypeSpecificDataTo(thisItem)
コード例 #39
0
 def test_canCopyNewComments(self):
     item = TrackerItem()
     commentsToCopy = ["comment1", "comment2"]
     item.withComments(commentsToCopy)
     self.assertEqual(item.comments('new'), commentsToCopy)
コード例 #40
0
 def test_noSpecificItemDataIsCopiedForBaseType(self):
     startingItem = TrackerItem()
     endingItem = startingItem
     itemToCopySpecificDataFrom = TrackerItem()
     itemToCopySpecificDataFrom.copyTypeSpecificDataTo(endingItem)
     self.assertEqual(startingItem, endingItem)
コード例 #41
0
 def test_canAddStatus(self):
     item = TrackerItem()
     status = TrackerItemStatus()
     item.withStatus(status)
     self.assertEqual(item.status(), status)
コード例 #42
0
 def test_canAddType(self):
     item = TrackerItem()
     type = "A Type"
     item.withType(type)
     self.assertEqual(type, item.type())
コード例 #43
0
 def test_noSpecificItemDataIsCopiedForBaseType(self):
     startingItem = TrackerItem()
     endingItem = startingItem
     itemToCopySpecificDataFrom = TrackerItem()
     itemToCopySpecificDataFrom.copyTypeSpecificDataTo(endingItem)
     self.assertEqual(startingItem, endingItem)
コード例 #44
0
 def test_canAddStatus(self):
     item = TrackerItem()
     status = TrackerItemStatus()
     item.withStatus(status)
     self.assertEqual(item.status(), status)