def test_context(): """The schema should be available in the template context.""" request = create_request() view = Schema(request=request) context = view.get_context_data() schema = get_schema() assert context["models"] == json.dumps(schema.models) assert context["foreign_keys"] == json.dumps(schema.foreign_keys) assert context["many_to_manys"] == json.dumps(schema.many_to_manys) assert context["one_to_ones"] == json.dumps(schema.one_to_ones) assert context["inheritance"] == json.dumps(schema.inheritance) assert context["proxies"] == json.dumps(schema.proxies)
def test_no_debug(): """Schema should be inaccessible outwith DEBUG mode.""" view = Schema.as_view() request = create_request() with override_settings(DEBUG=False): with pytest.raises(Http404): view(request)
def test_debug(): """Schema should be accessible in DEBUG mode.""" view = Schema.as_view() request = create_request() with override_settings(DEBUG=True): response = view(request) assert response.status_code == 200
def test_content(): """The page should be rendered.""" view = Schema.as_view() request = create_request() with override_settings(DEBUG=True): response = view(request) assert response.rendered_content.startswith("<!doctype html>")
from django.contrib import admin from django.urls import path, include from planes.views import login_view, logout_view from schema_graph.views import Schema urlpatterns = [ path('admin/', admin.site.urls), path('schema/', Schema.as_view()), path('login/', login_view, name='login'), path('logout/', logout_view, name='logout'), path('plane/', include('planes.urls', namespace='planes')), path('catalog/', include('catalog.urls', namespace='catalog')), path('analytics/', include('analytics.urls', namespace='analytics')), path('notifications/', include('notifications.urls', namespace='notifications')), ]
path('login', auth_views.LoginView.as_view(redirect_authenticated_user=True), name='login'), path('logout', auth_views.LogoutView.as_view(), name='logout'), #Password Verification path('password/reset', auth_views.PasswordResetView.as_view(), name='password_reset'), path('password/reset/done', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), path('passwod/reset/<uidb64>/<token>', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), path('password/reset/completed', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), path('password/reset/newpassword', auth_views.PasswordChangeView.as_view(), name='new_password'), path('password/reset/newpassword/done', auth_views.PasswordChangeDoneView.as_view(), name='password_change_done'), #Social authentications path('registration/', include('social_django.urls', namespace='social')), #API path('api/', include('api.urls')), #Schema path('schema/', Schema.as_view(), name='schema'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""nudb URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from schema_graph.views import Schema """admin.site.site_header = 'MonETS' admin.site.site_title = 'Dogs' #admin.site.index_title = 'Nazarbayev University Data Base'""" urlpatterns = [ path('admin/', admin.site.urls), path('', include('equipment.urls')), path('ckeditor/', include('ckeditor_uploader.urls')), path("schema/", Schema.as_view()), ]
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.conf.urls import url from django.contrib.auth.views import LogoutView from django.conf import settings from django.conf.urls.static import static from schema_graph.views import Schema from .views import home_page, results_page, top_movies_page, movie_page from accounts.views import login_page, register_page, account_page, register_genres_page urlpatterns = [ path('admin/', admin.site.urls), path('', home_page, name="index"), url(r'^login/$', login_page, name='login'), path('register/', register_page, name='register'), path('register_genres/', register_genres_page, name='register_genres'), path('logout/', LogoutView.as_view(), name="logout"), path('results/', results_page, name="result"), path('topmovies/', top_movies_page, name="topmovies"), path('account/', account_page, name="account"), url(r'^movie/(?P<movie_id>\d+)/$', movie_page, name="movie"), url(r"^schema/$", Schema.as_view()), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from schema_graph.views import Schema try: # Django 2+: from django.urls import path urlpatterns = [path("", Schema.as_view())] except ImportError: # Django < 2: from django.conf.urls import url urlpatterns = [url(r"^$", Schema.as_view())]
#Questions path('pharmacy/questions', views.questions), #Help path('help', views.help), #Answers path('answers', views.answers), #Profile path('profile', views.profile), #Edit F Name path('edit/firstname', views.editfname), #Edit L Name path('edit/lastname', views.editlname), #Edit Password path('edit/password', views.editpassword), #Delete Profile path('delete', views.deleteprofile), #Send Mail Delete path('deleteaccount', views.senddelete) ] urlpatterns += [path("schema/" , Schema.as_view())]