Ejemplo n.º 1
0
 def test_login_viewset_fails_with_incorrect_password(self):
     view = LoginView.as_view()
     data = {'email': '*****@*****.**', 'password': '******'}
     request = self.factory.post('/api/auth/login',
                                 data=data,
                                 format='json')
     response = view(request)
     self.assertEqual(response.status_code, 400)
Ejemplo n.º 2
0
 def test_login_viewset_logins_user(self):
     view = LoginView.as_view()
     data = {'email': '*****@*****.**', 'password': '******'}
     request = self.factory.post('/api/auth/login',
                                 data=data,
                                 format='json')
     response = view(request)
     self.assertEqual(response.status_code, 200)
     self.assertEqual(set(response.data.keys()),
                      set(['email', 'username', 'token', 'refresh_token']))
Ejemplo n.º 3
0
         name='restaurant-delete'),
    path('restaurants/<int:restaurant_id>/favorite/',
         views.restaurant_favorite,
         name='restaurant-favorite'),
    path('restaurants/<int:restaurant_id>/item/add/',
         views.item_create,
         name='item-create'),
    path('signup/', views.signup, name='signup'),
    path('signin/', views.signin, name='signin'),
    path('signout/', views.signout, name='signout'),
    path('no-access/', views.no_access, name='no-access'),
    path('api/list/', RestaurantListView.as_view(), name='api-list'),
    path('api/create/', RestaurantCreateView.as_view(), name='api-create'),
    path('api/<int:restaurant_id>/detail/',
         RestaurantDetailView.as_view(),
         name='api-detail'),
    path('api/<int:restaurant_id>/update/',
         RestaurantUpdateView.as_view(),
         name='api-update'),
    path('api/<int:restaurant_id>/delete/',
         RestaurantDeleteView.as_view(),
         name='api-delete'),
    path('api/register/', RegisterView.as_view(), name='api-register'),
    path('api/login/', LoginView.as_view(), name='api-login'),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Ejemplo n.º 4
0
"""config URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/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
from api.views import UserList, LoginView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('users/', UserList.as_view()),
    path('login/', LoginView.as_view())
]
Ejemplo n.º 5
0
                       LoginView, LogoutView, PasswordResetView, IntrestUpdateAPIView,
                       WorkExperienceAPIView, WorkExperienceUpdateAPIView, IntrestAPIView, PosterAPIView,
                       SkillsAPIView, CertificationAPIView, PublicationAPIView, ArticleAPIView,
                       PatentAPIView, BookAPIView, ConferenceAPIView, AchievementAPIView,
                       ExtraCurricularAPIView, SocialMediaLinksAPIView, CertificationUpdateAPIView,
                       PublicationUpdateAPIView, PatentUpdateAPIView, ArticleUpdateAPIView,
                       BookUpdateAPIView, PosterUpdateAPIView, ConferenceUpdateAPIView, ExtraCurricularUpdateAPIView,
                       AchievemntUpdateAPIView, SocialMediaLinksUpdateAPIView)
from django.conf import settings
from django.conf.urls.static import static


urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^api/accounts/', UserViewSet.as_view(), name='register'),
    url(r'^accounts/login', LoginView.as_view(), name='login'),
    url(r'^accounts/logout', LogoutView.as_view(), name='logout'),
    url(r'^password_reset', PasswordResetView.as_view(), name='password_reset'),
    url(r'^create/$', UserInfoAPIView.as_view(), name='user_info'),
    url(r'^(?P<username>[\w.@+-]+)/create/$', UserUpdateViewSet.as_view(), name='user_info_edit'), #update
    url(r'^education/', EducationalAPIView.as_view(), name='education_info'),
    url(r'^(?P<username>[\w.@+-]+)/education/$', EducationalUpdateAPIView.as_view(), name='education_info_update'),#update
    url(r'^work/$', WorkExperienceAPIView.as_view(), name='work'),
    url(r'^(?P<username>[\w.@+-]+)/work/', WorkExperienceUpdateAPIView.as_view(), name='work_update'),
    url(r'^intrest/', IntrestAPIView.as_view(), name='intrest'),
    url(r'^(?P<username>[\w.@+-]+)/intrest/', IntrestUpdateAPIView.as_view(), name='intrest_update'),
    url(r'^skills/', SkillsAPIView.as_view(), name='skills'),
    url(r'^(?P<username>[\w.@+-]+)/skills/', SkillsUpdateAPIView.as_view(), name='skills_update'),
    url(r'^certification/', CertificationAPIView.as_view(), name='certification'),
    url(r'^(?P<username>[\w.@+-]+)/certification/', CertificationUpdateAPIView.as_view(), name='certification_update'),
    url(r'^(?P<username>[\w.@+-]+)/publication/', PublicationUpdateAPIView.as_view(), name='publication_update'),
Ejemplo n.º 6
0
    url(r'^dbs/(?P<db_name>\w+)$',
        TablesListAPIView.as_view(),
        name='tbs-list'),

    # masters list and details
    # /dbs/[db_name]/tbs/[master_name]/records
    url(r'^dbs/(?P<db_name>\w+)/(?P<master_name>\w+)$',
        MastersListCreateAPIView.as_view(),
        name='master_create_list'),
    # /dbs/[db_name]/tbs/[master_name]/[record_id]
    url(r'^dbs/(?P<db_name>\w+)/(?P<master_name>\w+)/(?P<master_id>\d+)$',
        MasterAPIView.as_view(),
        name='master_crud'),

    # details list and details
    # /dbs/[db_name]/[master_name]/[record_id]/[detail_name]
    url(r'^dbs/(?P<db_name>\w+)/(?P<master_name>\w+)/(?P<master_id>\d+)/(?P<detail_name>\w+)$',
        DetailsListCreateAPIView.as_view(),
        name='detail_create_list'),
    # /dbs/[db_name]/[master_name]/[record_id]/[detail_name]/[detail_id]
    url(r'^dbs/(?P<db_name>\w+)/(?P<master_name>\w+)/(?P<master_id>\d+)/(?P<detail_name>\w+)/(?P<detail_id>\d+)$',
        DetailsAPIView.as_view(),
        name='detail_crud'),

    # /dbs/[db_name]/[master_name]/[master_id]/upload_files/[file_name]
    url(r'^docs$', FileUploadView.as_view(), name='file_upload'),

    # /login
    url(r'^login$', LoginView.as_view(), name='login'),
]
Ejemplo n.º 7
0
from django.contrib import admin
from django.urls import path,include
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.authtoken.views import ObtainAuthToken
from api.views import (
                        CoursesView,
                        UserMyView,
                        UserView,
                        CourseUserView,
                        LoginView,
                        LogoutView,
                        MessageView,
                    )
from django.views.decorators.csrf import csrf_exempt

urlpatterns = [
    path('rest-auth/login/',ObtainAuthToken.as_view()),
    path('auth/login/',csrf_exempt(LoginView.as_view())),
    path('auth/logout/<str:token>/',csrf_exempt(LogoutView.as_view())),
    path('courses/<str:token>/',csrf_exempt(CoursesView.as_view())),
    path('usermy/<str:token>/',csrf_exempt(UserMyView.as_view())),
    path('user/<str:token>/',csrf_exempt(UserView.as_view())),
    path('user/<int:pk>/<str:username>/<str:token>/',csrf_exempt(CourseUserView.as_view())),
    path('messages/<int:pk>/<str:token>/',csrf_exempt(MessageView.as_view())),
]
urlpatterns = format_suffix_patterns(urlpatterns)
Ejemplo n.º 8
0
import pytest
from django.test import RequestFactory
from rest_framework import status
from api.views import RegistrationView, TransferView, LoginView
from api.models import User, Wallet, Transfer, Currency

registration_view = RegistrationView.as_view()
transfer_view = TransferView.as_view()
login_view = LoginView.as_view()

# @pytest.mark.django_db
# def test_registrationView_validEmail_successResponse():
#     currency = Currency(usd_ratio=1, name='usd')
#     currency.save()
#
#     register_data_1 = {
#         "email": '*****@*****.**',
#         "password": "******",
#         "currency": "usd",
#         "balance": 100,
#     }
#
#     register_data_2 = {
#         "email": '*****@*****.**',
#         "password": "******",
#         "currency": "usd",
#         "balance": 100,
#     }
#
#     register_url = 'http://0.0.0.0:8000/api/register/'
#
Ejemplo n.º 9
0
from django.urls import path, include
from knox.views import LogoutView
from rest_framework import routers

from api import views
from api.views import LoginView, AccountView, CheckDBConnectionView

router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'roles', views.RoleViewSet)
router.register(r'connection_types', views.ConnectionTypeViewSet)
router.register(r'connections', views.ConnectionViewSet)

urlpatterns = [
    path('', include(router.urls)),

    path(r'auth/data/', AccountView.as_view()),
    path(r'auth/login/', LoginView.as_view()),
    path(r'auth/logout/', LogoutView.as_view()),
    path(r'configuration/', views.ConfigurationView.as_view()),
    path(r'csv/', views.CsvModelView.as_view()),
    path(r'load_ciso/', views.CisoDataView.as_view()),

    path(r'check_db_connection/', CheckDBConnectionView.as_view()),
]
Ejemplo n.º 10
0
)

urlpatterns = [
    path('list/bookedEvents/',
         ListBookedEventsView.as_view(),
         name='ListBookedEvents'),
    path('create/event/', CreateEventView.as_view(), name='CreateEvent'),
    path('update/event/<int:event_id>/',
         UpdateEventView.as_view(),
         name='UpdateEvent'),
    path('who/booked/event/<int:event_id>/',
         ListWhoBookedAnEventView.as_view(),
         name='BookedMyEvents'),
    path('book/event/<int:event_id>/',
         BookEventView.as_view(),
         name='BookEvent'),
    path('follow/', FollowView.as_view(), name='Follow'),
    path('unfollow/<str:following_username>/',
         UnfollowView.as_view(),
         name='unfollow'),
    path('myFollowing/',
         ListWhoAmIFollowingView.as_view(),
         name='BookedMyEvents'),
    path('api/list/', ListView.as_view(), name='APIlist'),
    path('api/specific/organizer/<str:username>/',
         SpecificView.as_view(),
         name='APISpecific'),
    path('api/signup/', SignupView.as_view(), name="APIsignup"),
    path('api/login/', LoginView.as_view(), name="APIlogin"),
    path('loginAPI/', TokenObtainPairView.as_view(), name="loginAPI"),
]
Ejemplo n.º 11
0
    https://docs.djangoproject.com/en/2.2/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
from django.conf.urls import include
from django.conf import settings
from django.conf.urls.static import static
from api.views import LoginView, LogoutView
urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/v1/', include('api.urls')),
    path('api-auth/', include('rest_framework.urls'), name="auth"),
    path('api/v1/auth/login/', LoginView.as_view(), name="login"),
    path('api/v1/auth/logout/', LogoutView.as_view()),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Ejemplo n.º 12
0
Archivo: urls.py Proyecto: marsv/clyde
from django.conf.urls import patterns, include, url
from api.views import RegistrationView, LoginView, ProjectView, LocationView, UserView
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'clyde.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^$', 'api.views.home'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^users/$', RegistrationView.as_view()),
    url(r'^users/login/$', LoginView.as_view()),
    url(r'^profile/$', UserView.as_view()),
	url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),



    url(r'^projects/$', ProjectView.as_view()),
    url(r'^(?P<slug>\w+)/$', ProjectView.as_view()),
    url(r'^(?P<slug>\w+)/locations/$', LocationView.as_view()),
    url(r'^(?P<slug>\w+)/(?P<snail>\w+)/$', LocationView.as_view()),
)
Ejemplo n.º 13
0
"""geodjango URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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.conf.urls import url
from django.urls import path, include

from rest_framework.authtoken import views

from api.views import LoginView

urlpatterns = [
    path('', admin.site.urls, name='admin'),
    url(r'^api-token-auth/', views.obtain_auth_token),
    path('api/', include('api.urls')),
    path('token/', LoginView.as_view()),
]
Ejemplo n.º 14
0
"""
URL patterns for farmhands API
"""

from django.conf.urls import url
from api.views import PlanView, PlanDetailView, UserPlanView,\
    UserPlanDetailView, LoginView, RegisterView, LogoutView

urlpatterns = [
    url(r'^plans$', PlanView.as_view(), name='plans'),
    url(r'^plans/(?P<planid>[0-9]+)$', PlanDetailView.as_view(), name='plan'),
    url(r'^users/(?P<userid>[0-9]+)/plans$',
        UserPlanView.as_view(), name='userplans'),
    url(r'^users/(?P<userid>[0-9]+)/plans/(?P<planid>[0-9]+)$',
        UserPlanDetailView.as_view(), name='userplan'),
    url(r'^login$', LoginView.as_view(), name='login'),
    url(r'^logout$', LogoutView.as_view(), name='logout'),
    url(r'^register$', RegisterView.as_view(), name='register')
]
Ejemplo n.º 15
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/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.conf.urls import url, include
from api.router import router
from api.views import RegistrationView, LoginView, VerifyView, RefreshView, ForgotPasswordView, ResetPasswordView, ImageView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^api/', include(router.urls)),
    url(r'api/auth/register', RegistrationView.as_view()),
    url(r'api/auth/login', LoginView.as_view()),
    url(r'api/auth/verify', VerifyView.as_view()),
    url(r'api/auth/refresh', RefreshView.as_view()),
    url(r'api/auth/forgot-password', ForgotPasswordView.as_view()),
    url(r'api/auth/reset-password', ResetPasswordView.as_view()),
    url(r'^assets/', ImageView.as_view())
]
Ejemplo n.º 16
0
from django.conf.urls import url 
from django.urls import path, include
from api.views import SignupView, LoginView, RegisterComplaintView, FeedbackView, MyComplaintsView

app_name = "api"
urlpatterns = [
    ## auth urls
    path('api/signup/', SignupView.as_view(), name="SignupView"),
    path('api/login/', LoginView.as_view(), name="LoginView"),

    ## user complaint urls
    path('api/registerComplaint/', RegisterComplaintView.as_view(), name="RegisterComplaintView"),
    path('api/myComplaints/<str:email>', MyComplaintsView.as_view(), name="MyComplaintsView"),
    
    ## feedback urls
    path('api/feedback/', FeedbackView.as_view(), name="FeedbackView")
]
Ejemplo n.º 17
0
"""jwtdemo URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/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
from api.views import LoginView, OrderView, JwtLoginView, JwtOrderView, ProLogin, ProOrder
from rest_framework_jwt.views import obtain_jwt_token
urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/login/', LoginView.as_view()),
    path('api/jwt/login/', JwtLoginView.as_view()),
    path('api/order/', OrderView.as_view()),
    path('api/jwt/order/', JwtOrderView.as_view()),
    path('api/jwtlogin/', ProLogin.as_view()),
    path('api/jwtorder/', ProOrder.as_view())
]
Ejemplo n.º 18
0
# from api.views import LoginView
#
from django.urls import path

from api.views import LoginView, ProfileView

app_name = 'api'
#
urlpatterns = [
    path('login/', LoginView.as_view(), name='login'),
    path('profile/', ProfileView.as_view(), name='profile'),
]
Ejemplo n.º 19
0
from django.conf.urls import url
from django.urls import include
from rest_framework import routers
from api import views
from api.views import TemplatesView, UploadView, InformationView, DisplayView, GetPPTView, LoginView

route = routers.DefaultRouter()

urlpatterns = [
    url(r'^login$', LoginView.as_view()),
    url(r'^templates$', TemplatesView.as_view()),
    url(r'^upload$', UploadView.as_view()),
    url(r'^information$', InformationView.as_view()),
    url(r'^display$', DisplayView.as_view()),
    url(r'^getPPT$', GetPPTView.as_view()),
]
Ejemplo n.º 20
0
from django.urls import path
from rest_framework.routers import DefaultRouter
from api.views import EvolucaoViewSet, PostagemList, PostagemDetail, UserCreate, LoginView  #,PostagemViewSet

router = DefaultRouter()
#router.register('postagem', PostagemViewSet, base_name='postagem')
router.register('evolucao', EvolucaoViewSet, base_name='evolucao')

urlpatterns = [
    path('postagem/', PostagemList.as_view()),
    path('postagem/<int:pk>', PostagemDetail.as_view()),
    path("users/", UserCreate.as_view(), name="user_create"),
    path("login/", LoginView.as_view(), name="login"),
]
urlpatterns += router.urls
Ejemplo n.º 21
0
    # re_path(r'^rest-auth/', include('rest_auth.urls')),
    re_path(r'^user/fb/login/$', FacebookLogin.as_view(), name='fb_login'),
    re_path(r'^user/google/login/$', GoogleLogin.as_view(), name='google_login'),
    re_path(r'^accounts/', include('allauth.urls')),
]

# Social login links
urlpatterns += [
    # re_path(r'^user/google/login/$', GoogleLoginApiView.as_view(), name='google_login'),
    re_path(r'^user/google/login/v2/', GoogleConfirm.as_view(), name='google_login2'),
    # re_path(r'^user/fb/login/$', FacebookLoginApiView.as_view(), name='facebook_login'),
    # re_path(r'^user/fb/login/v2', FacebookCheck.as_view(), name='facebook_login2'),
    re_path(r'^user/fb/login/v2/', FacebookConfirm.as_view(), name='facebook_login2'),
    # re_path(r'^user/login/$', LoginView.as_view(), name='login'),
    # re_path(r'^user/logout/$', LogoutView.as_view(), name='logout'),
    re_path(r'^user/login/$', LoginView.as_view(), name='login'),
    re_path(r'^user/logout/$', LogoutView.as_view(), name='logout'),
    re_path(r'^user/registration/', include('rest_auth.registration.urls')),
    re_path(r'^user/user-list/$', UserListApiView.as_view(), name='user_list'),
    re_path(r'^user/device/$', UserDevicesApiView.as_view(), name='user_device'),
    re_path(r'^user/$', UserInfo.as_view(), name='user'),
]

# API views to get or update Database from Google elements (calendars/events/contacts/accesses)
urlpatterns += [
    re_path(r'^user/calendars/synchronize', CalendarSyncApiView.as_view()), # get goole calendars
    re_path(r'^user/calendars/list', CalendarListApiView.as_view()), # get google calendars from db
    # re_path(r'^user/calendars/new', CalendarAddView.as_view()), # not needd - add new in
    re_path(r'^user/calendar$', CalendarAddApiView.as_view()), # get google calendars - for compatibility with app
    # re_path(r'^user/calendar/(?P<calendar_id>.+)$', CalendarDetailApiView.as_view()),
    re_path(r'^user/calendar/(?P<calendar_id>.+)/active$', CalendarActiveView.as_view()),
Ejemplo n.º 22
0
from django.conf.urls import url

from api.views import (LoginView, LogoutView, UserDetailsView,
                       PasswordChangeView, PasswordResetView,
                       PasswordResetConfirmView)

urlpatterns = [
    # URLs that do not require a session or valid token
    url(r'^password/reset$',
        PasswordResetView.as_view(),
        name='rest_password_reset'),
    url(r'^password/reset/confirm$',
        PasswordResetConfirmView.as_view(),
        name='rest_password_reset_confirm'),
    url(r'^login', LoginView.as_view(), name='rest_login'),
    # URLs that require a user to be logged in with a valid session / token.
    url(r'^logout$', LogoutView.as_view(), name='rest_logout'),
    url(r'^user$', UserDetailsView.as_view(), name='rest_user_details'),
    url(r'^password/change$',
        PasswordChangeView.as_view(),
        name='rest_password_change'),
]
Ejemplo n.º 23
0
from django.conf.urls import url
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from api.views import UserSignUp, LoginView

urlpatterns = [
    path('register/', UserSignUp.as_view(), name="register"),
    path('login/', LoginView.as_view(), name="login"),
    # path('profile/', MyProfile),
    # path('avatar/', Avatar),
    # path('change-password/', ChangePassword),
    # path('forgot-password/', ForgotPassword),
    # path('logout/', Logout),
    # path('home/', Dashboard),
]
# urlpatterns = format_suffix_patterns(urlpatterns)
Ejemplo n.º 24
0
from django.conf.urls import include, url
from django.contrib import admin
from api.views import UserViewSet, LoginView, ErrorView, NoteViewSet
from rest_framework import routers

router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'notes', NoteViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^login/?$', LoginView.as_view()),
    url(r'^sentry-demo/?$', ErrorView.as_view()),
]