def test_show_report_dialog(qtbot): api._backends[:] = [] assert len(api.get_backends()) == 0 b1 = api.backends.GithubBackend('ColinDuquesnoy', 'TestQCrash') b2 = api.backends.EmailBackend('*****@*****.**', 'TestQCrash') api.install_backend(b1, b2) assert len(api.get_backends()) == 2 dlg = api.show_report_dialog(modal=True) assert len(dlg.buttons) == 2 # force email backend to return True to close the dialog b2.old_send_report = b2.send_report qtbot.wait(1000) def send_report(*args, **kwargs): b2.old_send_report(*args, **kwargs) return True b2.send_report = send_report dlg.buttons[1].clicked.emit(True) dlg.reject()
def test_install_backend(): api._backends[:] = [] assert len(api.get_backends()) == 0 b1 = api.backends.GithubBackend('ColinDuquesnoy', 'TestQCrash') b2 = api.backends.EmailBackend('*****@*****.**', 'TestQCrash') api.install_backend(b1, b2) assert len(api.get_backends()) == 2 b1 = api.backends.GithubBackend('ColinDuquesnoy', 'TestQCrash') b2 = api.backends.EmailBackend('*****@*****.**', 'TestQCrash') api.install_backend(b1) assert len(api.get_backends()) == 3 api.install_backend(b2) assert len(api.get_backends()) == 4