Пример #1
0
def build_dash_config(tracker, app_token):
    recipe = dash.recipe('twitter_tracker', 'http://dash.fiveruns.com')
    recipe.counter('hits', 'Number of times the TERM is encountered', wrap=TwitterWordTrack.incr_hits)
    recipe.counter('misses', 'Number of times the TERM is not encountered', wrap=TwitterWordTrack.incr_misses)
    recipe.time('twitter_wait', 'Time spent waiting on Twitter', wrap=TwitterGetter.load)
    recipe.percentage('percent_hits', 'Percentage of messages that are hits', call=tracker.percent_hits)
    recipe.percentage('percent_misses', 'Percentage of messages that are misses', call=tracker.percent_misses)

    config = dash.configure(app_token=app_token)
    config.add_recipe('twitter_tracker')
    return config
Пример #2
0
 def testDuplicateRecipe(self):
     recipe1 = dash.recipe('foo', 'http://example.com')
     self.assertRaises(dash.recipes.DuplicateRecipe, dash.recipe, 'foo', 'http://example.com')
Пример #3
0
 def testRegisterRecipe(self):
     recipe1 = dash.recipe('foo', 'http://example.com')
     self.assertEqual(dash.recipes.registry[('foo', 'http://example.com')], recipe1)