Skip to content

Commit

Permalink
stat: add .last_updated to returned namedtuple
Browse files Browse the repository at this point in the history
  • Loading branch information
OddBloke committed Sep 29, 2022
1 parent 5f8cb2e commit b4cd05e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ def _get_base_url(self, url):
"is_dir",
"children",
"repo",
"last_updated",
],
)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1585,6 +1587,7 @@ def stat(self, pathobj=None):
The following fields are available:
ctime -- file creation time
mtime -- file modification time
last_updated -- artifact update time
created_by -- original uploader
modified_by -- last user modifying the file
mime_type -- MIME type of the file
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/test_artifactory_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit b4cd05e

Please sign in to comment.