RequestType: add name_display() and record constants

Just like some of the other tables, we have some constant
records that we use to denote types of things. This commit
adds constants which correlate with these record constants.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-08-07 15:43:44 -07:00
parent eb8ea53a44
commit 5bd3a7bbab
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
2 changed files with 28 additions and 2 deletions

View file

@ -1,7 +1,7 @@
import pytest
from aurweb.db import create, delete
from aurweb.models.request_type import RequestType
from aurweb.db import create, delete, query
from aurweb.models.request_type import DELETION_ID, MERGE_ID, ORPHAN_ID, RequestType
from aurweb.testing import setup_test_db
@ -22,3 +22,14 @@ def test_request_type_null_name_returns_empty_string():
assert bool(request_type.ID)
assert request_type.Name == str()
delete(RequestType, RequestType.ID == request_type.ID)
def test_request_type_name_display():
deletion = query(RequestType, RequestType.ID == DELETION_ID).first()
assert deletion.name_display() == "Deletion"
orphan = query(RequestType, RequestType.ID == ORPHAN_ID).first()
assert orphan.name_display() == "Orphan"
merge = query(RequestType, RequestType.ID == MERGE_ID).first()
assert merge.name_display() == "Merge"