def test_refresh_with_callbacks(refresher):
 callbacks = [Mock()]
 pgexecute_class = Mock()
 pgexecute = Mock()
 special = Mock()
 with patch('pgcli.completion_refresher.PGExecute', pgexecute_class):
  refresher.refreshers = {}
  refresher.refresh(pgexecute, special, callbacks)
  time.sleep(1)
  assert (callbacks[0].call_count == 1)

def test_refresh_with_callbacks ( refresher ) : callbacks = [ Mock ( ) ] pgexecute_class = Mock ( ) pgexecute = Mock ( ) special = Mock ( ) with patch ( 'pgcli.completion_refresher.PGExecute' , pgexecute_class ) : refresher . refreshers = { } refresher . refresh ( pgexecute , special , callbacks ) time . sleep ( 1 ) assert ( callbacks [ 0 ] . call_count == 1 )
callbacks must be called .