DataONEorg / scythe

Scythe, the data citation harvester
Other
7 stars 2 forks source link

scythe_get_key fails with error #16

Closed mbjones closed 3 years ago

mbjones commented 3 years ago

When I run tests without either the scopus_key or the springer_key set, tests fail. I can trace this back to an exception thrown by scythe_get_key() when either key is not set. This prevents tests from running in environments in which keys are unavailable.

> scythe_get_key()
Error in b_macos_get(self, private, service, username, keyring) : 
  keyring error (macOS Keychain), cannot get password: The specified item could not be found in the keychain.
Called from: b_macos_get(self, private, service, username, keyring)

The function also hardcodes the names of the keys, which is difficult to maintain.

mbjones commented 3 years ago

I refactored the scythe_get_key to:

I then refactored the scopus and springer search functions to use this because DRY.