示例#1
0
 def testChangedCollections(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     c.pull()  # get the full git history
     # check for known changed collections in this repo
     changed = c.get_changed_docs(
         '637bb5a35f861d84c115e5e6c11030d1ecec92e0')
     self.assertEqual({u'TestUserB/fungal-trees.json'}, changed)
     changed = c.get_changed_docs(
         'd17e91ae85e829a4dcc0115d5d33bf0dca179247')
     self.assertEqual({u'TestUserB/fungal-trees.json'}, changed)
     changed = c.get_changed_docs(
         'af72fb2cc060936c9afce03495ec0ab662a783f6')
     expected = {
         u'test-user-a/my-favorite-trees.json',
         u'TestUserB/fungal-trees.json'
     }
     self.assertEqual(expected, changed)
     # check a doc that changed
     changed = c.get_changed_docs(
         'af72fb2cc060936c9afce03495ec0ab662a783f6',
         [u'TestUserB/fungal-trees.json'])
     self.assertEqual({u'TestUserB/fungal-trees.json'}, changed)
     # check a doc that didn't change
     changed = c.get_changed_docs(
         'd17e91ae85e829a4dcc0115d5d33bf0dca179247',
         [u'test-user-a/my-favorite-trees.json'])
     self.assertEqual(set(), changed)
     # check a bogus doc id should work, but find nothing
     changed = c.get_changed_docs(
         'd17e91ae85e829a4dcc0115d5d33bf0dca179247',
         [u'bogus/fake-trees.json'])
     self.assertEqual(set(), changed)
     # passing a foreign (or nonsense) SHA should raise a ValueError
     self.assertRaises(ValueError, c.get_changed_docs, 'bogus')
示例#2
0
 def testCollectionIds(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     k = list(c.get_doc_ids())
     k.sort()
     expected = ['TestUserB/fungal-trees', 'TestUserB/my-favorite-trees',
                 'test-user-a/my-favorite-trees', 'test-user-a/trees-about-bees']
     self.assertEqual(k, expected)
示例#3
0
 def testChangedCollections(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     c.pull()  # get the full git history
     # check for known changed collections in this repo
     changed = c.get_changed_docs('637bb5a35f861d84c115e5e6c11030d1ecec92e0')
     self.assertEqual({u'TestUserB/fungal-trees.json'}, changed)
     changed = c.get_changed_docs('d17e91ae85e829a4dcc0115d5d33bf0dca179247')
     self.assertEqual({u'TestUserB/fungal-trees.json'}, changed)
     changed = c.get_changed_docs('af72fb2cc060936c9afce03495ec0ab662a783f6')
     expected = {u'test-user-a/my-favorite-trees.json', u'TestUserB/fungal-trees.json'}
     self.assertEqual(expected, changed)
     # check a doc that changed
     changed = c.get_changed_docs('af72fb2cc060936c9afce03495ec0ab662a783f6',
                                  [u'TestUserB/fungal-trees.json'])
     self.assertEqual({u'TestUserB/fungal-trees.json'}, changed)
     # check a doc that didn't change
     changed = c.get_changed_docs('d17e91ae85e829a4dcc0115d5d33bf0dca179247',
                                  [u'test-user-a/my-favorite-trees.json'])
     self.assertEqual(set(), changed)
     # check a bogus doc id should work, but find nothing
     changed = c.get_changed_docs('d17e91ae85e829a4dcc0115d5d33bf0dca179247',
                                  [u'bogus/fake-trees.json'])
     self.assertEqual(set(), changed)
     # passing a foreign (or nonsense) SHA should raise a ValueError
     self.assertRaises(ValueError, c.get_changed_docs, 'bogus')
示例#4
0
 def testCollectionIds(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     k = list(c.get_doc_ids())
     k.sort()
     expected = [
         'TestUserB/fungal-trees', 'TestUserB/my-favorite-trees',
         'test-user-a/my-favorite-trees', 'test-user-a/trees-about-bees'
     ]
     self.assertEqual(k, expected)
示例#5
0
 def testCollectionDeletion(self):
     c = _TreeCollectionStore(repos_dict=self.r)
示例#6
0
 def testNewCollectionIds(self):
     # We assign each new collection a unique id based on the owner's userid +
     # the slugified name, serializing with $NAME-2, etc if this id already exists.
     c = _TreeCollectionStore(repos_dict=self.r)
示例#7
0
 def testCollectionCopying(self):
     c = _TreeCollectionStore(repos_dict=self.r)
示例#8
0
 def testURL(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     self.assertTrue(
         c.get_public_url('TestUserB/fungal-trees').endswith(
             'ngal-trees.json'))
示例#9
0
 def testInit(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     self.assertEqual(1, len(c._shards))
示例#10
0
 def testCollectionDeletion(self):
     c = _TreeCollectionStore(repos_dict=self.r)
示例#11
0
 def testNewCollectionIds(self):
     # We assign each new collection a unique id based on the owner's userid +
     # the slugified name, serializing with $NAME-2, etc if this id already exists.
     c = _TreeCollectionStore(repos_dict=self.r)
示例#12
0
 def testCollectionCopying(self):
     c = _TreeCollectionStore(repos_dict=self.r)
示例#13
0
 def testURL(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     self.assertTrue(c.get_public_url('TestUserB/fungal-trees').endswith('ngal-trees.json'))
示例#14
0
 def testInit(self):
     c = _TreeCollectionStore(repos_dict=self.r)
     self.assertEqual(1, len(c._shards))