def test_writeread(tmpdir, config): config.loadFromDict({ 'endpoint': 'api.nsone.net', 'default_key': 'test1', 'keys': { 'test1': { 'key': 'key-1', 'desc': 'test key number 1', 'writeLock': True } } }) # Write config to temp. tmp_cfg_path = str(tmpdir.join('test_writeread.json')) config.write(tmp_cfg_path) # Read new but identical config instance. cfg_read = Config(tmp_cfg_path) assert cfg_read is not config assert cfg_read.getEndpoint() == config.getEndpoint() assert cfg_read.getCurrentKeyID() == config.getCurrentKeyID() assert cfg_read.isKeyWriteLocked() == config.isKeyWriteLocked()