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())
 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)
 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)
 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)
 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)
 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)
 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())
 def test_canAddOwner(self):
     item = TrackerItem()
     owner = "me"
     item.withOwner(owner)
     self.assertEqual(owner, item.owner())
 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)
 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)
 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)
 def test_canSyncDescriptionWithItem(self):
     descriptionToSync = "Check for this"
     item1 = TrackerItem().withDescription("summary")
     item2 = TrackerItem().withDescription(descriptionToSync)
     item1.syncWith(item2)
     self.assertEqual(item1.description(), descriptionToSync)
 def test_canCopyNewComments(self):
     item = TrackerItem()
     commentsToCopy = ["comment1", "comment2"]
     item.withComments(commentsToCopy)
     self.assertEqual(item.comments('new'), commentsToCopy)
 def test_canAddRequestor(self):
     item = TrackerItem()
     requestor = "me"
     item.withRequestor(requestor)
     self.assertEqual(requestor, item.requestor())
 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)
 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)
 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)
 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)
 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)
 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)
 def test_canAddStatus(self):
     item = TrackerItem()
     status = TrackerItemStatus()
     item.withStatus(status)
     self.assertEqual(item.status(), status)