Sage-Bionetworks / synapsePythonClient

Programmatic interface to Synapse services for Python
https://www.synapse.org
Apache License 2.0
65 stars 67 forks source link

[SYNPY-1453] Guard around modified time item in cache #1080

Closed BryanFauble closed 3 months ago

BryanFauble commented 3 months ago

Problem:

  1. In the cache if a cache value was a dictionary but it did not contain the exact key of modified_time the code would return back the parent dict - causing further code to fail that was expecting a string to be returned.

Solution:

  1. Adding a guard statement in _get_cache_modified_time that verified that the data returned is going to be a string or the value for modified_time

Testing:

Added unit tests around the logic that verify the behavior if the cache map:

  1. Is a dict but does not contain modified_time key
  2. Is a dict but contains neither of the expected keys
  3. The entry is an empty dict
  4. The entry is None
sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
5 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud