Exemple #1
0
 def get_doc_meta_data_series(self, board, idid):
     return [
         types.DocMetaData(idid, idid - 1,
                           board + '_title_doc_meta_data_series',
                           board + '_author', idid * 256, board,
                           [idid + 1, idid + 2, idid + 3])
     ]
 def get_doc_by_url(self, url):
     self.counter += 1
     doc = common.ADocument()
     doc.url = url
     doc.meta_data = types.DocMetaData(None, None, url, url, int(url), url,
                                       [0, 0, 0])
     doc.real_data = types.DocRealData(url, [])
     return doc
Exemple #3
0
 def get_doc_by_url(self, url):
     doc = common.ADocument()
     doc.url = url
     doc.meta_data = types.DocMetaData(int(url), int(url), 'meow', 'wang',
                                       int(url), None, [0, 0, 0])
     doc.real_data = types.DocRealData(str(self.last_time), [])
     self.num_called += 1
     return doc
Exemple #4
0
 def get_doc_by_id(self, idid):
     doc = common.ADocument()
     doc.url = str(idid)
     doc.meta_data = types.DocMetaData(idid, idid, 'meow', 'wang', idid,
                                       None, [0, 0, 0])
     doc.real_data = types.DocRealData(str(self.last_time), [])
     self.num_called += 1
     return doc
Exemple #5
0
 def get_doc_meta_data_of_author(self, board, author):
     idid = int(board)
     return [
         types.DocMetaData(idid, idid - 1,
                           board + '_title_get_doc_meta_data_of_author',
                           author, idid * 256, board,
                           [idid + 1, idid + 2, idid + 3])
     ]
Exemple #6
0
 def get_doc_meta_data_after_time(self, board, post_time):
     idid = int(post_time / 256)
     return [
         types.DocMetaData(idid, idid - 1,
                           board + '_title_get_doc_meta_after_time',
                           board + '_author', post_time, board,
                           [idid + 1, idid + 2, idid + 3])
     ]
 def runTest(self):
     dmd = types.DocMetaData(5, 3, 'meow', 'wang', 9, 'blah', [2, 5, 7])
     buf = b''.join([
         b'\x05\x00\x00\x00', b'\x03\x00\x00\x00',
         b'\x04\x00\x00\x00\x00\x00\x00\x00meow',
         b'\x04\x00\x00\x00\x00\x00\x00\x00wang',
         b'\x09\x00\x00\x00\x00\x00\x00\x00',
         b'\x04\x00\x00\x00\x00\x00\x00\x00blah', b'\x02\x00\x00\x00',
         b'\x05\x00\x00\x00', b'\x07\x00\x00\x00'
     ])
     self.assertEqual(dmd.dump(), buf)