From 4b0bd95a5e73e1e99a35d4681faa93c5b40adb77 Mon Sep 17 00:00:00 2001 From: John Helmert III Date: Sat, 16 Nov 2019 21:10:23 -0600 Subject: [PATCH] Add basic test for Terminal._load_mailcaps() --- tests/test_terminal.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_terminal.py b/tests/test_terminal.py index 68426be..bc98698 100644 --- a/tests/test_terminal.py +++ b/tests/test_terminal.py @@ -11,6 +11,7 @@ import six import pytest from tuir.theme import Theme +from tuir.terminal import Terminal from tuir.docs import (HELP, REPLY_FILE, COMMENT_EDIT_FILE, TOKEN, SUBMISSION_FILE, SUBMISSION_EDIT_FILE, MESSAGE_FILE) from tuir.exceptions import TemporaryFileError, BrowserError @@ -472,6 +473,17 @@ def test_terminal_open_link_subprocess(terminal): assert get_error() +def test_terminal_load_mailcaps(stdscr, config): + with mock.patch('os.path.exists', return_value=True): + # This value should be restored after terminal._load_mailcaps() is + # called + os.environ['MAILCAPS'] = 'NON_NULL' + + Terminal(stdscr, config=config) + + assert os.environ['MAILCAPS'] == 'NON_NULL' + + def test_terminal_open_browser_display(terminal): terminal._display = True