コード例 #1
0
class Test(unittest.TestCase):

    def setUp(self):
        self.client = ClientCassandra("BlwData")

    def testInsert(self):
        category = Category('Administracion/Oficina', ['http://www.computrabajo.com.ar/bt-ofr-SC000-1.htm'])
        page = Page("http://www.computrabajo.com.ar/bt-ofrd-hpedsar-1234.htm",'/bt-ofr-','/bt-ofrd-',category)
        tags = list()
        tags.append('hola')
        tags.append('mundo')
        page.addContent("UTF-8",tags )
        timestamp= self.client.insertPage(page)
        assert(timestamp.bit_length >0)
        
    
    def testRead(self):
        result = self.client.getPages("http://www.computrabajo.com.ar/bt-ofrd-caram-543248.htm",'tags')
        print result.get('tags')
        prev = 0
        prev = zlib.crc32(result.get('tags'), prev)
        print prev
        assert(1718164868 == prev)
    
    def testCount(self):
        result = self.client.getCountCategory('Administracion/Oficina')
        print result
        assert(10 == result)
コード例 #2
0
 def setUp(self):
     self.client = ClientCassandra("BlwData")