示例#1
0
def test_gen_params():
    """lib.kuzuha.datetime.datetime.nowにパッチ当てられなかったから他はパス
    """
    actual = kuzuha.gen_params('', {'date': '20131014'})
    desired = DEFAULT_PARAMS_DETAIL.copy()
    desired.update({'kwd': '', 'chk20131014.dat': 'checked', 'k': 'あ'})
    assert actual == desired
示例#2
0
def test_gen_params():
    """lib.kuzuha.datetime.datetime.nowにパッチ当てられなかったから他はパス
    """
    actual = kuzuha.gen_params('', {'date': '20131014'})
    desired = DEFAULT_PARAMS_DETAIL.copy()
    desired.update({
        'kwd': '',
        'chk20131014.dat': 'checked'
    })
    assert_equals(actual, desired)
示例#3
0
 def run(self):
     params = kuzuha.gen_params('', {'minute': 20})
     posts = kuzuha.get_log_as_dict('qwerty', params, url=True) or {}
     for (post_id, post) in posts.items():
         if 'date' not in post:
             continue
         stored_body = self.find(post_id)
         body = self.build_body(post, post_id)
         if body and body != stored_body:
             self.update(post_id, body, 'index')
         else:
             logger.debug('NO CHANGE: %s' % body)
     if self.actions:
         logger.info(helpers.bulk(self.es, self.actions))
         self.es.indices.refresh(index='qwerty')
 def run(self):
     params = kuzuha.gen_params('', {'minute': 50})
     posts = kuzuha.get_log_as_dict('misao', params, url=True) or {}
     for (post_id, post) in posts.items():
         if 'date' not in post:
             continue
         stored_body = self.find(post_id)
         body = self.build_body(post, post_id)
         if body and body != stored_body:
             self.update(post_id, body, 'index')
         else:
             logger.debug('NO CHANGE: %s' % body)
     if self.actions:
         logger.info(helpers.bulk(self.es, self.actions))
         self.es.indices.refresh(index='misao')