def test_assign_uuid_does_not_touch_existing_uuids(mock_uuid4): mock_uuid4.return_value = UUID('727238f3-8ed6-40b6-97d2-dc3cd1429131') schema = load_schema('hep') subschema = schema['properties']['authors'] record = { '$schema': 'http://localhost:5000/records/schemas/hep.json', 'authors': [ { 'full_name': 'Ellis, John Richard', 'uuid': 'e14955b0-7e57-41a0-90a8-f4c64eb8f4e9', }, ], } assert validate(record['authors'], subschema) is None assign_uuid(None, record) expected = [ { 'full_name': 'Ellis, John Richard', 'uuid': 'e14955b0-7e57-41a0-90a8-f4c64eb8f4e9', }, ] result = record['authors'] assert validate(result, subschema) is None assert expected == result