def test_get_request(self, rf): request = rf.get(reverse('health_check')) response = HealthCheckView.as_view()(request) content = json.loads(response.content) assert response.status_code == 200 assert content.get('server') == 'pong' and content.get( 'database') == 'pong'
def test_broken_db(self, rf): os.environ['DB_NAME'] = "DB" request = rf.get(reverse('health_check')) response = HealthCheckView.as_view()(request) content = json.loads(response.content) assert response.status_code == 200 assert content.get('server') == 'pong' and content.get( 'database') == 'error'
""" URL routing patterns for the Deis project. This is the "master" urls.py which then includes the urls.py files of installed apps. """ from django.conf.urls import include, url from api.views import HealthCheckView urlpatterns = [ url(r'^healthz$', HealthCheckView.as_view()), url(r'^v2/', include('api.urls')), ]
""" URL routing patterns for the Deis project. This is the "master" urls.py which then includes the urls.py files of installed apps. """ from __future__ import unicode_literals from django.conf import settings from django.conf.urls import patterns, include, url from django.contrib import admin from api.views import HealthCheckView admin.autodiscover() urlpatterns = patterns( '', url(r'^healthz$', HealthCheckView.as_view()), url(r'^v1/', include('api.urls')), ) if settings.WEB_ENABLED: urlpatterns += patterns( '', url(r'^', include('web.urls')), url(r'^admin/', include(admin.site.urls)), )
from django.urls import path from api.views import SnapshotCallbackView, HealthCheckView, ActiveWalletProcessCallbackView, LastDBInfoView, \ ValidateAndAutoProcessView, ActiveWalletDownloadCallbackView, RunAutoProcessView urlpatterns = [ path('snapshot/callback/<int:snapshot_id>', SnapshotCallbackView.as_view(), name="snapshot_callback"), path('active_wallet/process/complete/<int:active_wallet_process_id>/<int:snapshot_id>/', ActiveWalletProcessCallbackView.as_view(), name="active_wallet_process_callback"), path('healthcheck', HealthCheckView.as_view(), name="healthcheck"), path('last_restore_db_info', LastDBInfoView.as_view(), name="last_restore_db_info"), path('validate_and_auto_process', ValidateAndAutoProcessView.as_view(), name="validate_and_auto_process"), path('active_wallet/download/callback', ActiveWalletDownloadCallbackView.as_view(), name="active_wallet_download_callback"), path('run_auto_process', RunAutoProcessView.as_view(), name="run_auto_process"), ]
""" URL routing patterns for the Deis project. This is the "master" urls.py which then includes the urls.py files of installed apps. """ from __future__ import unicode_literals from django.conf import settings from django.conf.urls import patterns, include, url from django.contrib import admin from api.views import HealthCheckView admin.autodiscover() urlpatterns = patterns( '', url(r'^health-check$', HealthCheckView.as_view()), url(r'^v2/', include('api.urls')), ) if settings.WEB_ENABLED: urlpatterns += patterns( '', url(r'^', include('web.urls')), url(r'^admin/', include(admin.site.urls)), )
from api.views import HealthCheckView from django.urls import path from rest_framework import routers router = routers.DefaultRouter() urlpatterns = [ path("", HealthCheckView.as_view()), ]