def test_update(mock_identifiers_client, mocked_checksum, logged_in): cli = MinidClient() cli.update('hdl:20.500.12633/mock-hdl', title='foo.txt', locations=['http://example.com']) mock_identifiers_client.update_identifier.assert_called_with( 'hdl:20.500.12633/mock-hdl', metadata={'title': 'foo.txt'}, location=['http://example.com'])
def test_update_translates_hdls(mock_identifiers_client, logged_in): cli = MinidClient() cli.update('minid:first', replaces='minid:second', replaced_by='minid:thd') expected = call('hdl:20.500.12582/first', replaces='hdl:20.500.12582/second', replaced_by='hdl:20.500.12582/thd', metadata={}) assert mock_identifiers_client.update_identifier.called assert mock_identifiers_client.update_identifier.call_args == expected
def test_update_invalid_args(mock_identifiers_client, logged_in): cli = MinidClient() with pytest.raises(MinidException): cli.update('hdl:20.500.12633/1234567', non_existant_arg='foobar')