def test_cached_collect_reviewboard_stats(self): tempdir = tempfile.gettempdir() request = create_mock_request('anthony', 'andy') with mock.patch( 'collect_reviewboard_stats.collect_reviewboard_stats', return_value=request ) as mock_collect_reviewboard_stats: result_1 = collect_reviewboard_stats.cached_collect_reviewboard_stats('http://reviewboard.anthony.com', ['anthony'], tempdir) result_2 = collect_reviewboard_stats.cached_collect_reviewboard_stats('http://reviewboard.anthony.com', ['anthony'], tempdir) self.assertEqual(result_1.id, result_2.id) self.assertTrue(mock_collect_reviewboard_stats.call_count < 2)
def reviewboard_dashboard(): client_kwargs = { 'username': app.config['username'], 'password': app.config['password'] } reviewboard_stats = collect_reviewboard_stats.cached_collect_reviewboard_stats( app.config['reviewboard_url'], app.config['reviewboard_users'], client_kwargs=client_kwargs, max_results=200, last_updated_from=datetime.datetime.now() - datetime.timedelta(days=14), status='pending', cache_directory=app.config['cache_directory'], ) return render_template('reviewboard_dashboard.html', reviewboard_stats=reviewboard_stats, review_url_generator=lambda review_id: '%s/r/%s' % (app.config['reviewboard_url'], review_id))
def reviewboard_dashboard(): client_kwargs = { 'username': app.config['username'], 'password': app.config['password'] } reviewboard_stats = collect_reviewboard_stats.cached_collect_reviewboard_stats( app.config['reviewboard_url'], app.config['reviewboard_users'], client_kwargs=client_kwargs, max_results=200, last_updated_from=datetime.datetime.now() - datetime.timedelta(days=14), status='pending', cache_directory=app.config['cache_directory'], ) return render_template( 'reviewboard_dashboard.html', reviewboard_stats=reviewboard_stats, review_url_generator=lambda review_id: '%s/r/%s' % (app.config['reviewboard_url'], review_id) )