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')
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)
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')
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)
def testCollectionDeletion(self): c = _TreeCollectionStore(repos_dict=self.r)
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)
def testCollectionCopying(self): c = _TreeCollectionStore(repos_dict=self.r)
def testURL(self): c = _TreeCollectionStore(repos_dict=self.r) self.assertTrue( c.get_public_url('TestUserB/fungal-trees').endswith( 'ngal-trees.json'))
def testInit(self): c = _TreeCollectionStore(repos_dict=self.r) self.assertEqual(1, len(c._shards))
def testURL(self): c = _TreeCollectionStore(repos_dict=self.r) self.assertTrue(c.get_public_url('TestUserB/fungal-trees').endswith('ngal-trees.json'))