tests: add checks for __repr__ methods (#34807)

This commit is contained in:
Frédéric Péters 2019-07-14 12:41:28 +02:00
parent 4af6edad53
commit 75601f9cec
1 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,9 @@ from wcs.qommon import evalutils
from wcs.qommon.http_request import HTTPRequest
from wcs.qommon.backoffice.listing import pagination_links
from wcs.qommon.emails import email as send_email, docutils
from wcs.fields import StringField
from wcs.workflows import Workflow
from wcs.wf.jump import JumpWorkflowStatusItem
from django.core.cache import cache
@ -475,3 +478,19 @@ def test_dict_from_prefix():
d = evalutils.dict_from_prefix('v', {'k1':'v1', 'k2':'v2'})
assert d == {}
def test_objects_repr():
workflow = Workflow(name='wf')
st1 = workflow.add_status('Status1', 'st1')
jump = JumpWorkflowStatusItem()
jump.id = '_jump'
st1.items.append(jump)
assert 'st1' in repr(st1)
assert '_jump' in repr(jump)
field = StringField()
assert repr(field) == '<StringField None None>'
field.id = '1'
field.label = 'test'
assert repr(field) == "<StringField 1 'test'>"