def testPathToRoot(self):
    firstChildName = 'firstChild'
    firstChildDesc = 'firstDesc'
    secondChildName = 'secondChild'
    secondChildDesc = 'secondDesc'
    firstChild = Folder().createFolder(self.publicFolder, firstChildName, firstChildDesc, creator=self.users[0])
    secondChild = Folder().createFolder(firstChild, secondChildName, secondChildDesc, creator=self.users[0])
    baseItem = Item().createItem('blah', self.users[0], secondChild, 'foo')
    resp = self.request(path=('/item/%s/rootpath' % baseItem['_id']), method='GET')
    self.assertStatusOk(resp)
    pathToRoot = resp.json
    self.assertEqual(pathToRoot[0]['type'], 'user')
    self.assertEqual(pathToRoot[0]['object']['login'], self.users[0]['login'])
    self.assertEqual(pathToRoot[1]['type'], 'folder')
    self.assertEqual(pathToRoot[1]['object']['name'], self.publicFolder['name'])
    self.assertEqual(pathToRoot[2]['type'], 'folder')
    self.assertEqual(pathToRoot[2]['object']['name'], firstChild['name'])
    self.assertEqual(pathToRoot[3]['type'], 'folder')
    self.assertEqual(pathToRoot[3]['object']['name'], secondChild['name'])
def testPathToRoot(self):
    firstChildName = 'firstChild'
    firstChildDesc = 'firstDesc'
    secondChildName = 'secondChild'
    secondChildDesc = 'secondDesc'
    firstChild = Folder().createFolder(self.publicFolder, firstChildName, firstChildDesc, creator=self.users[0])
    secondChild = Folder().createFolder(firstChild, secondChildName, secondChildDesc, creator=self.users[0])
    baseItem = Item().createItem('blah', self.users[0], secondChild, 'foo')
    resp = self.request(path=('/item/%s/rootpath' % baseItem['_id']), method='GET')
    self.assertStatusOk(resp)
    pathToRoot = resp.json
    self.assertEqual(pathToRoot[0]['type'], 'user')
    self.assertEqual(pathToRoot[0]['object']['login'], self.users[0]['login'])
    self.assertEqual(pathToRoot[1]['type'], 'folder')
    self.assertEqual(pathToRoot[1]['object']['name'], self.publicFolder['name'])
    self.assertEqual(pathToRoot[2]['type'], 'folder')
    self.assertEqual(pathToRoot[2]['object']['name'], firstChild['name'])
    self.assertEqual(pathToRoot[3]['type'], 'folder')
    self.assertEqual(pathToRoot[3]['object']['name'], secondChild['name'])