Fixed existing unit tests, image cache robustness enhancement, dockerfile update

pull/636/head
Piero Toffanin 2019-03-19 17:58:04 -04:00
rodzic e11a58739a
commit 97903a2648
5 zmienionych plików z 25 dodań i 17 usunięć

Wyświetl plik

@ -20,7 +20,6 @@ RUN printf "deb http://mirror.steadfast.net/debian/ testing main contrib
# Install Node.js GDAL, nginx, letsencrypt, psql
RUN apt-get -qq update && apt-get -qq install -t testing -y binutils libproj-dev gdal-bin nginx grass-core certbot && apt-get -qq install -y gettext-base cron postgresql-client-9.6
# Install pip reqs
ADD requirements.txt /webodm/
RUN pip install -r requirements.txt
@ -38,7 +37,7 @@ RUN npm install --quiet
WORKDIR /webodm
RUN npm install --quiet -g webpack && npm install --quiet -g webpack-cli && npm install --quiet && webpack --mode production
RUN python manage.py collectstatic --noinput
#RUN echo "from app.plugins import register_plugins; register_plugins()" | python manage.py shell
RUN bash app/scripts/plugin_cleanup.sh && echo "from app.plugins import build_plugins;build_plugins()" | python manage.py shell
RUN rm /webodm/webodm/secret_key.py

Wyświetl plik

@ -93,7 +93,6 @@ class PluginAdmin(admin.ModelAdmin):
def get_urls(self):
urls = super().get_urls()
print(urls)
custom_urls = [
url(
r'^(?P<plugin_name>.+)/enable/$',

Wyświetl plik

@ -1,14 +1,20 @@
import datetime
import logging
from django import template
register = template.Library()
logger = logging.getLogger('app.logger')
@register.simple_tag(takes_context=True)
def settings_image_url(context, image):
return "/media/" + getattr(context['SETTINGS'], image).url
img_cache = getattr(context['SETTINGS'], image)
try:
return "/media/" + img_cache.url
except FileNotFoundError:
logger.warning("Cannot get %s, this could mean the image was deleted." % image)
return ''
@register.simple_tag(takes_context=True)
def get_footer(context):

Wyświetl plik

@ -57,7 +57,7 @@ class TestApiPreset(BootTestCase):
self.assertTrue(res.status_code == status.HTTP_200_OK)
# Only ours and global presets are available
self.assertTrue(len(res.data) == 11)
self.assertTrue(len(res.data) == 12)
self.assertTrue('My Local Preset' in [preset['name'] for preset in res.data])
self.assertTrue('High Resolution' in [preset['name'] for preset in res.data])
self.assertTrue('Global Preset #1' in [preset['name'] for preset in res.data])

Wyświetl plik

@ -1,13 +1,22 @@
import sys
from django.conf.urls import url, include
from django.shortcuts import render_to_response
from django.template import RequestContext
from .views import app as app_views, public as public_views
from .plugins import get_app_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'),
@ -28,14 +37,9 @@ urlpatterns = [
url(r'^api/', include("app.api.urls")),
]
# TODO: is there a way to place plugins /public directories
# into the static build directories and let nginx serve them?
urlpatterns += get_app_url_patterns()
handler404 = app_views.handler404
handler500 = app_views.handler500
# Test cases call boot() independently
# Also don't execute boot with celery workers
if not settings.WORKER_RUNNING and not settings.TESTING:
boot()
# TODO: is there a way to place plugins /public directories
# into the static build directories and let nginx serve them?
urlpatterns += get_app_url_patterns()