()
| 10 | |
| 11 | |
| 12 | def test_setting(): |
| 13 | with tempfile.TemporaryDirectory() as cache_dir: |
| 14 | os.environ['CACHE_DIR'] = cache_dir |
| 15 | plugin = WechatyPlugin() |
| 16 | |
| 17 | plugin.setting['unk'] = 11 |
| 18 | |
| 19 | assert 'count' not in plugin.setting |
| 20 | plugin.setting['count'] = 20 |
| 21 | |
| 22 | # load the setting file |
| 23 | assert os.path.exists(plugin.setting_file) |
| 24 | |
| 25 | with open(plugin.setting_file, 'r', encoding='utf-8') as f: |
| 26 | data = json.load(f) |
| 27 | |
| 28 | assert data['unk'] == 11 |
| 29 | assert data['count'] == 20 |
| 30 | |
| 31 | |
| 32 | class TestWechatySetting(unittest.TestCase): |
nothing calls this directly
no test coverage detected