From f8c1d526436ddd1ed3ab0c9512e611f97c016784 Mon Sep 17 00:00:00 2001 From: David Gasparian Date: Mon, 8 Aug 2016 17:25:29 +0400 Subject: [PATCH] Added test case for invalid config file exception handling --- tests/test_config_utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_config_utils.py b/tests/test_config_utils.py index ea58f61a..bce2c9a8 100644 --- a/tests/test_config_utils.py +++ b/tests/test_config_utils.py @@ -229,6 +229,13 @@ def test_file_config(): assert config == {} +def test_invalid_file_config(): + from bigchaindb.config_utils import file_config, CONFIG_DEFAULT_PATH + with patch('builtins.open', mock_open(read_data='{_INVALID_JSON_}')) as m: + with pytest.raises(exceptions.ConfigurationError): + file_config() + + def test_write_config(): from bigchaindb.config_utils import write_config, CONFIG_DEFAULT_PATH m = mock_open()