def test_plugin_functions(self): # Check db/fs syncing if os.path.exists('plugins/test_copy'): print("Removing plugins/test_copy") shutil.rmtree('plugins/test_copy') sync_plugin_db() self.assertTrue(Plugin.objects.filter(pk='test_copy').count() == 0) shutil.copytree('plugins/test', 'plugins/test_copy') sync_plugin_db() self.assertTrue(Plugin.objects.filter(pk='test_copy').count() == 1) shutil.rmtree('plugins/test_copy') sync_plugin_db() self.assertTrue(Plugin.objects.filter(pk='test_copy').count() == 0) # Get manifest works and parses JSON p = get_plugin_by_name("test") self.assertEqual(p.get_manifest()['author'], "Piero Toffanin")
from .plugins.views import app_view_handler, root_url_patterns from app.boot import boot from webodm import settings from app.plugins import sync_plugin_db # Test cases call boot() independently # Also don't execute boot with celery workers if not settings.WORKER_RUNNING and not settings.TESTING: boot() # During testing, boot() is not called (see above) # but we need to know which plugins are available to mount the proper # routes via urlpatterns. if settings.TESTING: sync_plugin_db() urlpatterns = [ url(r'^$', app_views.index, name='index'), url(r'^welcome/$', app_views.welcome, name='welcome'), url(r'^dashboard/$', app_views.dashboard, name='dashboard'), url(r'^map/project/(?P<project_pk>[^/.]+)/task/(?P<task_pk>[^/.]+)/$', app_views.map, name='map'), url(r'^map/project/(?P<project_pk>[^/.]+)/$', app_views.map, name='map'), url(r'^3d/project/(?P<project_pk>[^/.]+)/task/(?P<task_pk>[^/.]+)/$', app_views.model_display, name='model_display'), url(r'^public/task/(?P<task_pk>[^/.]+)/map/$', public_views.map, name='public_map'),