def test_invalid_file_none(): # Setup validator = Validator() # System under test with pytest.raises(ValidationError): validator.validate_file(None)
def test_invalid_file_name(): # Setup validator = Validator() invalid_file_name = str(uuid.uuid4()) # System under test with pytest.raises(ValidationError): validator.validate_file(invalid_file_name)
def test_valid_file(tmpdir): # Setup validator = Validator() valid_file = tmpdir.join("valid_json.json") valid_file_content = "{\"version\": \"alpha\", \"schema\": \"core\"}" valid_file.write(valid_file_content) # System under test validator.validate_file(valid_file.strpath)
def test_invalid_file_invalid_json(tmpdir): # Setup validator = Validator() invalid_file = tmpdir.join("invalid_json.json") invalid_file_content = "{\"version\": \"alpha,}" invalid_file.write(invalid_file_content) # System under test with pytest.raises(ValidationError): validator.validate_file(invalid_file.strpath)