def test_send_current_report(self, fromConfig, fromOptions, getLogger, time): initial = 10 time.side_effect = [initial, initial] fromOptions.return_value = Mock() options = Mock() options.interval = 6 options.oneshot = True options.print_ = False options.log_dir = '' options.log_file = '' virtwho = VirtWho(Mock(), options, config_dir="/nonexistant") virtwho.oneshot_remaining = ['config_name'] config = Mock() config.hash = "config_hash" config.name = "config_name" virtwho.send = Mock() virtwho.send.return_value = True report = HostGuestAssociationReport(config, {'hypervisors': {}}) report.state = AbstractVirtReport.STATE_PROCESSING virtwho.queued_reports[config.name] = report virtwho.send_current_report() def check_report_state(report): report.state = AbstractVirtReport.STATE_FINISHED virtwho.check_report_state = Mock(side_effect=check_report_state) virtwho.check_reports_state() virtwho.send.assert_called_with(report) self.assertEquals(virtwho.send_after, initial + 60)