def test_help(mock_head, mock_new_tab): mock_response = Mock(spec='status_code') mock_head.return_value = mock_response docs_url = "http://fomod-designer.readthedocs.io/en/stable/index.html" local_docs = "file://" + \ os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "resources", "docs", "index.html")) mock_response.status_code = codes.ok MainFrame.help() mock_head.assert_called_once_with(docs_url, timeout=0.5) mock_new_tab.assert_called_once_with(docs_url) mock_response.status_code = codes.forbidden MainFrame.help() mock_head.assert_called_with(docs_url, timeout=0.5) mock_new_tab.assert_called_with(local_docs)
def test_mainframe(qtbot): main_window = MainFrame() main_window.show() qtbot.addWidget(main_window) assert main_window.isVisible()