diff --git a/artifactory.py b/artifactory.py index c76925b..587c00e 100755 --- a/artifactory.py +++ b/artifactory.py @@ -603,6 +603,7 @@ def _get_base_url(self, url): "is_dir", "children", "repo", + "last_updated", ], ) @@ -897,6 +898,7 @@ def stat(self, pathobj): is_dir=is_dir, children=children, repo=jsn.get("repo", None), + last_updated=dateutil.parser.parse(jsn["lastUpdated"]), ) return stat @@ -1594,6 +1596,7 @@ def stat(self, pathobj=None): md5 -- MD5 digest of the file is_dir -- 'True' if path is a directory children -- list of children names + last_updated -- artifact update time """ pathobj = pathobj or self return self._accessor.stat(pathobj=pathobj) diff --git a/tests/unit/test_artifactory_path.py b/tests/unit/test_artifactory_path.py index e8d5c69..8a59ba1 100644 --- a/tests/unit/test_artifactory_path.py +++ b/tests/unit/test_artifactory_path.py @@ -498,6 +498,9 @@ def test_stat(self): self.assertEqual( stats.mtime, dateutil.parser.parse("2014-02-24T21:20:36.000+04:00") ) + self.assertEqual( + stats.last_updated, dateutil.parser.parse("2014-02-24T21:20:36.000+04:00") + ) self.assertEqual(stats.created_by, "someuser") self.assertEqual(stats.modified_by, "anotheruser") self.assertEqual(stats.mime_type, "application/octet-stream") @@ -532,6 +535,9 @@ def test_stat(self): self.assertEqual( stats.mtime, dateutil.parser.parse("2014-02-18T15:35:29.361+04:00") ) + self.assertEqual( + stats.last_updated, dateutil.parser.parse("2014-02-18T15:35:29.361+04:00") + ) self.assertEqual(stats.created_by, None) self.assertEqual(stats.modified_by, None) self.assertEqual(stats.mime_type, None) @@ -594,6 +600,9 @@ def test_stat_no_sha256(self): self.assertEqual( stats.mtime, dateutil.parser.parse("2014-02-24T21:20:36.000+04:00") ) + self.assertEqual( + stats.last_updated, dateutil.parser.parse("2014-02-24T21:20:36.000+04:00") + ) self.assertEqual(stats.created_by, "someuser") self.assertEqual(stats.modified_by, "anotheruser") self.assertEqual(stats.mime_type, "application/octet-stream")