def test_corrupted_json(tmpdir): path = str(tmpdir.join('corrupted_json.json')) with open(path, 'w') as sfile: sfile.write('{}') assert pycheckupdate._get_last_check(path) is None
def test_corrupted_file(tmpdir): path = str(tmpdir.join('corrupted_file.json')) with open(path, 'w') as sfile: sfile.write('42 is the answer') assert pycheckupdate._get_last_check(path) is None
def test_file_not_found(tmpdir): path = str(tmpdir.join('file_not_found.json')) assert pycheckupdate._get_last_check(path) is None
def test_get_last_check(tmpdir): path = str(tmpdir.join('get_last_check.json')) pycheckupdate._save_check(path, '0.10.0') assert pycheckupdate._get_last_check(path) == datetime.date.today()