Fix NPE when setting tag to not expire
This commit is contained in:
parent
04d6d5696b
commit
ac566c7054
2 changed files with 8 additions and 1 deletions
|
@ -421,7 +421,7 @@ def set_tag_end_ms(tag, end_ms):
|
|||
.where(TagToRepositoryTag.tag == tag)
|
||||
.get()).repository_tag
|
||||
|
||||
old_style_tag.lifetime_end_ts = end_ms / 1000
|
||||
old_style_tag.lifetime_end_ts = end_ms / 1000 if end_ms is not None else None
|
||||
old_style_tag.save()
|
||||
except TagToRepositoryTag.DoesNotExist:
|
||||
pass
|
||||
|
|
|
@ -214,6 +214,13 @@ def test_change_tag_expiration(timedelta, expected_timedelta, initialized_db):
|
|||
expected_ms = (updated_tag.lifetime_start_ms + offset)
|
||||
assert updated_tag.lifetime_end_ms == expected_ms
|
||||
|
||||
original_end_ms, okay = change_tag_expiration(tag, None)
|
||||
assert okay
|
||||
assert original_end_ms == expected_ms
|
||||
|
||||
updated_tag = Tag.get(id=tag.id)
|
||||
assert updated_tag.lifetime_end_ms is None
|
||||
|
||||
|
||||
def test_set_tag_expiration_for_manifest(initialized_db):
|
||||
tag = Tag.get()
|
||||
|
|
Reference in a new issue