예제 #1
0
def testItems(dataConnection):
    testItem = ScrumblesObjects.Item()
    testItem.itemType = 'UNIT_TEST_2'
    testItem.itemTitle = 'UNIT_TEST_2'
    testItem.itemDescription = 'UNIT TESTING ITEM CREATION, previous test failed to delete'
    testItemCreationQuery = ScrumblesData.Query.createObject(testItem)
    assert testItemCreationQuery is not None
    dataConnection.connect()

    dataConnection.setData(testItemCreationQuery)

    testItemSearchQuery = ScrumblesData.CardQuery.getCardByCardID(
        testItem.itemID)
    testItemSearchResult = dataConnection.getData(testItemSearchQuery)
    retrievedItem = ScrumblesObjects.Item(testItemSearchResult[0])

    dataConnection.close()

    assert retrievedItem.itemDescription == testItem.itemDescription

    dataConnection.connect()
    dataConnection.setData(ScrumblesData.Query.deleteObject(retrievedItem))
    itemAfterDeletionQueryResult = dataConnection.getData(
        ScrumblesData.CardQuery.getCardByCardID(retrievedItem.itemID))
    dataConnection.close()
    assert itemAfterDeletionQueryResult == ()
    print('Item', testItem.itemID,
          ' Data successfully created and deleted on remote server')
예제 #2
0
    def ok(self):
        if self.item is None:
            item = ScrumblesObjects.Item()
        else:
            item = self.item
        item.itemTitle = self.itemTitleEntry.get()
        item.itemDescription = self.itemDescriptionEntry.get('1.0', 'end-1c')
        item.itemType = self.ItemTypebox.get()
        item.itemPoints = self.pointsEntry.get()
        item.itemPriority = item.priorityTextToNumberMap[
            self.itemPriorityCombobox.get()]
        self.validateName(item.itemTitle)
        comment = ScrumblesObjects.Comment()
        comment.commentContent = self.commentTextBox.get('1.0', 'end-1c')
        if not self.isTest:
            comment.commentUserID = self.parent.activeUser.userID
        comment.commentItemID = item.itemID
        if not self.isTest:
            self.writeData(item, comment)

        self.exit()
예제 #3
0
    def updateAllObjects(self):
        if self.firstLoad:
            time.sleep(1)
        self.isLoading = True
        funcStartTime = time.clock()

        self.conn.connect()
        self.users.clear()
        self.items.clear()
        self.projects.clear()
        self.comments.clear()
        self.tags.clear()
        self.sprints.clear()
        self.itemMap = {}
        self.sprintMap = {}
        self.commentMap = {}
        self.projectMap = {}
        self.userMap = {}
        #print('getting tables')
        loopStartTime = time.clock()
        userTable = self.conn.getData(Query.getAllUsers)
        itemTable = self.conn.getData(Query.getAllCards)
        projectTable = self.conn.getData(Query.getAllProjects)
        commentTable = self.conn.getData(Query.getAllComments)
        sprintTable = self.conn.getData(Query.getAllSprints)
        userToProjectRelationTable = self.conn.getData(Query.getAllUserProject)
        itemToProjectRelationTable = self.conn.getData(Query.getAllProjectItem)
        itemTimeLineTable = self.conn.getData('SELECT * FROM CardTimeLine')
        epicTable = self.conn.getData('SELECT * FROM EpicTable')

        self.conn.close()

        #print('Tables loaded in %fms' % ((time.clock()-loopStartTime)*1000) )

        loopStartTime = time.clock()
        #print('splicing vectors')

        timeLineMap = self.mapTimeline(itemTimeLineTable)
        epicMap = self.buildEpicMap(epicTable)
        for comment in commentTable:
            Comment = ScrumblesObjects.Comment(comment)
            self.comments.append(Comment)
            self.commentMap[Comment.commentID] = Comment
        #print('Comment List Built in %fms' % ((time.clock() - loopStartTime) * 1000))

        loopStartTime = time.clock()
        for item in itemTable:
            Item = ScrumblesObjects.Item(item)
            Item.listOfComments = [
                C for C in self.comments if C.commentItemID == Item.itemID
            ]
            self.applyItemLine(Item, timeLineMap)
            # try:
            #     Item.itemTimeLine = timeLineMap[Item.itemID]
            # except KeyError:
            #     timeLineMap = self.reloadTimeLineMap()
            if 'AssignedToSPrint' in Item.itemTimeLine:
                Item.itemTimeLine['AssignedToSprint'] = Item.itemTimeLine[
                    'AssignedToSPrint']
            #self.populateItemTimeLine(Item,timeLineMap)
            self.itemMap[Item.itemID] = Item
            self.items.append(Item)
        #print('Item List Built in %fms' % ((time.clock() - loopStartTime) * 1000))

        loopStartTime = time.clock()
        for I in self.items:
            if I.itemID in epicMap:  #epicMap[subitemID]->EpicID
                self.itemMap[epicMap[I.itemID]].subItemList.append(
                    I)  #itemMap[itemID]->Item
        #print('Item subitems spliced in %fms' % ((time.clock() - loopStartTime) * 1000))

        loopStartTime = time.clock()
        for user in userTable:
            User = ScrumblesObjects.User(user)
            User.listOfAssignedItems = [
                I for I in self.items if I.itemUserID == User.userID
            ]
            User.listOfComments = [
                C for C in self.comments if C.commentUserID == User.userID
            ]
            self.users.append(User)
            self.userMap[User.userID] = User
        #print('User List Built in %fms' % ((time.clock() - loopStartTime) * 1000))

        loopStartTime = time.clock()
        for sprint in sprintTable:
            Sprint = ScrumblesObjects.Sprint(sprint)
            Sprint.listOfAssignedItems = [
                I for I in self.items if I.itemSprintID == Sprint.sprintID
            ]
            Sprint.listOfAssignedUsers = [
                U for U in self.users if U.userID in
                [I.itemUserID for I in Sprint.listOfAssignedItems]
            ]
            self.sprints.append(Sprint)
            self.sprintMap[Sprint.sprintID] = Sprint
        #print('Sprint List Built in %fms' % ((time.clock() - loopStartTime) * 1000))

        loopStartTime = time.clock()
        for project in projectTable:
            Project = ScrumblesObjects.Project(project)
            Project.listOfAssignedSprints = [
                S for S in self.sprints if S.projectID == Project.projectID
            ]
            self.projects.append(Project)
            self.projectMap[Project.projectID] = Project
        #print('Project List Built in %fms' % ((time.clock() - loopStartTime) * 1000))

        loopStartTime = time.clock()
        for user in self.users:
            for dict in userToProjectRelationTable:
                if dict['UserID'] == user.userID:
                    for project in self.projects:
                        if dict['ProjectID'] == project.projectID:
                            user.listOfProjects.append(project)
        #print('Users Spliced to Projects in %fms' % ((time.clock() - loopStartTime) * 1000))

        loopStartTime = time.clock()
        for project in self.projects:
            for dict in userToProjectRelationTable:
                if dict['ProjectID'] == project.projectID:
                    for user in self.users:
                        if dict['UserID'] == user.userID:
                            project.listOfAssignedUsers.append(user)
            #print('Projects spliced to users in %fms' % ((time.clock() - loopStartTime) * 1000))

            loopStartTime = time.clock()
            for dict in itemToProjectRelationTable:
                if dict['ProjectID'] == project.projectID:
                    for item in self.items:
                        if dict['ItemID'] == item.itemID:
                            item.projectID = project.projectID

                            project.listOfAssignedItems.append(item)
        #print('Items Spliced to Projects in %fms' % ((time.clock() - loopStartTime) * 1000))

        #self.debugDump()
        #print('Data Loaded in %fs' % (time.clock()-funcStartTime))
        self.isLoading = False
        return True
예제 #4
0
db = DataBlock.DataBlock(mode='test')
db.updateAllObjects()

Tsprint = ScrumblesObjects.Sprint()
Tsprint.sprintName = 'TUnit Test'
Tsprint.sprintStartDate = datetime.now()
Tsprint.sprintDueDate = datetime.now()
Tsprint.projectID = 0

print(type(Tsprint))
print(repr(Tsprint))
print(type(Tsprint) is ScrumblesObjects.Sprint)
print(type(Tsprint) is data.ScrumblesObjects.Sprint)

TItem = ScrumblesObjects.Item()
TItem.itemTitle = "Test Item to add to Test Sprint"
TItem.itemDescription = 'Test TEST TEST'
TItem.itemPriority = 0
TItem.itemStatus = 0
TItem.itemPoints = 9
TItem.itemType = 'User Story'

print('adding sprint')
try:
    db.addNewScrumblesObject(Tsprint)
    testRun['Add Sprint'] = (True, 'Pass')
except Exception as e:
    test = 'Failed to add Sprint to DB\n' + str(e)
    testRun['Add Sprint'] = (False, test)
예제 #5
0
assert len(listOfSprints) == len(allSprintsQueryResult)

for element in allItemsQueryResult:
    assert len(element) == 11
    assert 'CardID' in element
    assert 'CardType' in element
    assert 'CardPriority' in element
    assert 'CardTitle' in element
    assert 'CardDescription' in element
    assert 'CardCreatedDate' in element
    assert 'CardDueDate' in element
    assert 'CardCodeLink' in element
    assert 'SprintID' in element
    assert 'UserID' in element
    assert 'Status' in element
    item = ScrumblesObjects.Item(element)
    assert item.itemID == element['CardID']
    assert item.itemType == element['CardType']
    assert item.itemPriority == element['CardPriority']
    assert item.itemTitle == element['CardTitle']
    assert item.itemDescription == element['CardDescription']
    assert item.itemCreationDate == element['CardCreatedDate']
    assert item.itemDueDate == element['CardDueDate']
    assert item.itemCodeLink == element['CardCodeLink']
    assert item.itemSprintID == element['SprintID']
    assert item.itemUserID == element['UserID']
    assert item.itemStatus == element['Status']
    listOfItems.append(item)
assert len(listOfItems) == len(allItemsQueryResult)

for element in allCommentsQueryResult:
예제 #6
0
    print(item.itemID)
    print(item.itemType)
    print(item.itemTitle)
    print(item.itemDescription)
    print(item.itemCreationDate)
    print(item.itemDueDate)
    print(item.itemCodeLink)
    print(item.itemSprintID)
    print(item.itemUserID)
    print(item.itemStatus)


login_info = ScrumblesData.DataBaseLoginInfo()
login_info.userID = 'test_user'
login_info.password = '******'
login_info.ipaddress = '173.230.136.241'
login_info.defaultDB = 'test'

dataConnection = ScrumblesData.ScrumblesData(login_info)
dataConnection.connect()
itemTable = dataConnection.getData(ScrumblesData.Query.getAllCards)
dataConnection.close()

listOfAllItems = []
for row in itemTable:
    item = ScrumblesObjects.Item(row)
    listOfAllItems.append(item)

for item in listOfAllItems:
    printItemDetails(item)