api: do not list default workflows in dependencies (#69238)
gitea-wip/wcs/pipeline/head Build started...
Details
gitea-wip/wcs/pipeline/head Build started...
Details
This commit is contained in:
parent
a8742d4a15
commit
7e1d6c466e
|
@ -7,6 +7,7 @@ import xml.etree.ElementTree as ET
|
|||
import pytest
|
||||
|
||||
from wcs.blocks import BlockDef
|
||||
from wcs.carddef import CardDef
|
||||
from wcs.categories import Category, DataSourceCategory, MailTemplateCategory
|
||||
from wcs.data_sources import NamedDataSource
|
||||
from wcs.fields import BlockField, StringField
|
||||
|
@ -32,6 +33,7 @@ coucou = 1234
|
|||
|
||||
Category.wipe()
|
||||
FormDef.wipe()
|
||||
CardDef.wipe()
|
||||
BlockDef.wipe()
|
||||
Workflow.wipe()
|
||||
MailTemplate.wipe()
|
||||
|
@ -206,6 +208,26 @@ def test_export_import_dependencies(pub):
|
|||
assert {(x['id'], x['type']) for x in resp.json['data']} == {('cat', 'data-sources-categories')}
|
||||
|
||||
|
||||
def test_export_import_dependencies_default_workflow(pub):
|
||||
formdef = FormDef()
|
||||
formdef.name = 'Test'
|
||||
formdef.workflow_id = '_default'
|
||||
formdef.store()
|
||||
|
||||
carddef = CardDef()
|
||||
carddef.name = 'Test'
|
||||
carddef.workflow_id = '_carddef_default'
|
||||
carddef.store()
|
||||
|
||||
resp = get_app(pub).get(sign_uri('/api/export-import/forms/'))
|
||||
resp = get_app(pub).get(sign_uri(resp.json['data'][0]['urls']['dependencies']))
|
||||
assert resp.json['data'] == []
|
||||
|
||||
resp = get_app(pub).get(sign_uri('/api/export-import/cards/'))
|
||||
resp = get_app(pub).get(sign_uri(resp.json['data'][0]['urls']['dependencies']))
|
||||
assert resp.json['data'] == []
|
||||
|
||||
|
||||
def create_bundle(*args):
|
||||
tar_io = io.BytesIO()
|
||||
with tarfile.open(mode='w', fileobj=tar_io) as tar:
|
||||
|
|
|
@ -685,7 +685,7 @@ class FormDef(StorableObject):
|
|||
|
||||
def get_dependencies(self):
|
||||
yield self.category
|
||||
if self.workflow_id:
|
||||
if self.workflow_id and self.workflow.id not in ['_carddef_default', '_default']:
|
||||
yield self.workflow
|
||||
for field in self.fields or []:
|
||||
yield from field.get_dependencies()
|
||||
|
|
Loading…
Reference in New Issue