Conversation
korydraughn
left a comment
There was a problem hiding this comment.
Does the updated test reproduce the bug reported in the issue?
| return self._opts['timestamps'] | ||
|
|
||
| __kw: Dict[str, Any] = {} # default (empty) keywords | ||
| __default_kw: Dict[str, Any] = {} # default (empty) keywords |
There was a problem hiding this comment.
Is this still needed/used?
There was a problem hiding this comment.
I'll delete that . it's no longer used.
| with new_session() as ses: | ||
| d = ses.data_objects.create(data_name:="/{adm.zone}/home/{user.name}/testfile".format(**locals())) | ||
| d.metadata(admin=True) | ||
|
|
||
| with new_session() as ses: |
There was a problem hiding this comment.
Would it improve the test to use unique variable names for the with-statements (e.g. ses1 and ses2)?
| self.assertIn(kw.ADMIN_KW, get_call_keywords(md_modified)) | ||
|
|
||
| # The modified admin setting should be reflected when reading it back from the object's | ||
| # internal options # bookkeeping. |
There was a problem hiding this comment.
Is the trailing # bookkeeping a leftover?
There was a problem hiding this comment.
no , the extra # was to be deleted if I was editing better. But I can leave the word out if it makes more sense.
There was a problem hiding this comment.
Yeah, let's remove that word.
| # This function duplicates the way in which the client API endpoint calculates iRODS option keywords | ||
| # for the underlying API call: | ||
| get_call_keywords = lambda metacoll: metacoll._manager._updated_keywords((),) |
There was a problem hiding this comment.
Is this saying it duplicates the key-value pairs stored in the manager?
I'm struggling to understand what this does?
There was a problem hiding this comment.
It emulates the internal calculation of api keywords given to the iRODS api, based on the input metacoll.
So for two different such objects:
get_call_keywords(Data.metadata(admin=False)) -> {}and
get_call_keywords(Data.metadata(admin=True)) -> {**ADMIN_KW:''}is what you would expect.
There was a problem hiding this comment.
It emulates the internal calculation of api keywords given to the iRODS api, based on the input metacoll.
By "iRODS api", I take it you're referring to the PRC's interface and NOT the iRODS RPC interface, correct?
So, that lambda is using code that is private to the implementation to prove correctness?
Is there no way to do this without reaching behind the public API of the library?
Yes. if you revert the changes, the test fails on the line |
Use of ADMIN_KW carried over into subsequent metadata calls even if unwanted.