parent
b4ecb0f97a
commit
f3f42eea2b
|
@ -1,3 +1,4 @@
|
||||||
|
from crc.models.workflow import WorkflowLibraryModel
|
||||||
from tests.base_test import BaseTest
|
from tests.base_test import BaseTest
|
||||||
|
|
||||||
from crc import session
|
from crc import session
|
||||||
|
@ -60,5 +61,34 @@ class TestWorkflowApi(BaseTest):
|
||||||
self.assertIsNotNone(returned.get('libraries'))
|
self.assertIsNotNone(returned.get('libraries'))
|
||||||
self.assertEqual(len(returned['libraries']),0)
|
self.assertEqual(len(returned['libraries']),0)
|
||||||
|
|
||||||
|
def test_library_cleanup(self):
|
||||||
|
self.load_example_data()
|
||||||
|
spec1 = ExampleDataLoader().create_spec('hello_world', 'Hello World', category_id=0, library=False,
|
||||||
|
from_tests=True)
|
||||||
|
|
||||||
|
spec2 = ExampleDataLoader().create_spec('hello_world_lib', 'Hello World Library', category_id=0, library=True,
|
||||||
|
from_tests=True)
|
||||||
|
user = session.query(UserModel).first()
|
||||||
|
self.assertIsNotNone(user)
|
||||||
|
|
||||||
|
rv = self.app.post(f'/v1.0/workflow-specification/%s/library/%s'%(spec1.id,spec2.id),
|
||||||
|
follow_redirects=True,
|
||||||
|
content_type="application/json",
|
||||||
|
headers=self.logged_in_headers())
|
||||||
|
self.assert_success(rv)
|
||||||
|
|
||||||
|
rv = self.app.get(f'/v1.0/workflow-specification/%s'%spec1.id,follow_redirects=True,
|
||||||
|
content_type="application/json",
|
||||||
|
headers=self.logged_in_headers())
|
||||||
|
returned=rv.json
|
||||||
|
lib = session.query(WorkflowLibraryModel).filter(WorkflowLibraryModel.library_spec_id==spec2.id).first()
|
||||||
|
self.assertIsNotNone(lib)
|
||||||
|
|
||||||
|
rv = self.app.delete(f'/v1.0/workflow-specification/%s'%(spec1.id),follow_redirects=True,
|
||||||
|
content_type="application/json",
|
||||||
|
headers=self.logged_in_headers())
|
||||||
|
|
||||||
|
lib = session.query(WorkflowLibraryModel).filter(WorkflowLibraryModel.library_spec_id==spec2.id).first()
|
||||||
|
self.assertIsNone(lib)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue