class TestViews(unittest.TestCase): def setUp(self): couchquery.createdb(testdb_url) self.testdb = Database(testdb_url) self.testdb.sync_design_doc("logcompare", logcompare.design_doc) def tearDown(self): couchquery.deletedb(testdb_url) def test_runCounts(self): product = 'Fennec' os = 'Maemo' testtype = 'crashtests' count = 3 # create documents where for a specific number of them the product, os, and testype are specified for i in range(0, count): mockdata.create_doc(self.testdb, product=product, os=os, testtype=testtype) for i in range(0, 10): mockdata.create_doc(self.testdb) counts = self.testdb.views.logcompare.runCounts(reduce = True, group = True).items() for key, value in counts: if key == [product, os, testtype]: self.failUnlessEqual(value, count, "Value should be equal to the count for a combination of product, os, testtype")
class TestViews(unittest.TestCase): def setUp(self): couchquery.createdb(testdb_url) self.testdb = Database(testdb_url) self.testdb.sync_design_doc("logcompare", logcompare.design_doc) def tearDown(self): couchquery.deletedb(testdb_url) def test_runCounts(self): product = 'Fennec' os = 'Maemo' testtype = 'crashtests' count = 3 # create documents where for a specific number of them the product, os, and testype are specified for i in range(0, count): mockdata.create_doc(self.testdb, product=product, os=os, testtype=testtype) for i in range(0, 10): mockdata.create_doc(self.testdb) counts = self.testdb.views.logcompare.runCounts(reduce=True, group=True).items() for key, value in counts: if key == [product, os, testtype]: self.failUnlessEqual( value, count, "Value should be equal to the count for a combination of product, os, testtype" )
def setupdb(): db = Database("http://localhost:5984/test_pythonviews") try: deletedb(db) except: pass createdb(db) db.sync_design_doc("pythonView", os.path.join(this_directory, "design"), language="python") db.sync_design_doc("javascriptView", os.path.join(this_directory, "design"), language="javascript") return db
def main(): db = Database('http://localhost:5984/crashtest') db.sync_design_doc('pyCrash', os.path.join(os.path.dirname(__file__), 'design'), language="python")