def test_write(): clear() assert not os.path.isfile(settings.DB) utils.write(fake_useragent_dict) assert os.path.isfile(settings.DB)
def test_utils_write(path): data = {'foo': 'bar'} utils.write(path, data) with io.open(path, mode='rt', encoding='utf-8') as fp: expected = json.loads(fp.read()) assert expected == data