Exemplo n.º 1
0
 def test_send_email(self):
     self.client = Client()
     # Проверка, что НЕ зарегистрированный пользователь не может залогиниться
     login = self.client.login(
         username="******", password="******"
     )
     self.assertFalse(login)
     # создаем запрос методом POST с данными нового пользователя на страницу регистрации
     request = RequestFactory().post(
         "/auth/signup/",
         {
             "username": "******",
             "email": "*****@*****.**",
             "password1": "skynetMyLove",
             "password2": "skynetMyLove",
             "first_name": "Sara",
             "last_name": "Conor",
         },
         follow=True,
     )
     SignUp.as_view()(request)
     # Проверка, что новый пользователь зарегистрировался и может залогиниться
     login = self.client.login(
         username="******", password="******"
     )
     self.assertTrue(login)
     # Проверка отправки почты и корректности введенных данных
     self.assertEqual(len(mail.outbox), 1)
     self.assertEqual(mail.outbox[0].subject, "Регистрация пользователя")
     self.assertEqual(
         mail.outbox[0].body,
         "Conor Sara, благодарим за регистрацию на нашем сайте!",
     )
     self.assertEqual(mail.outbox[0].from_email, "*****@*****.**")
     self.assertEqual(mail.outbox[0].to, ["*****@*****.**"])
Exemplo n.º 2
0
from django.urls import path, re_path
from users.views import SignUp


urlpatterns = [
    path('signup/', SignUp.as_view(), name="signup"),
    

]
from django.urls    import path
from users.views    import SignUp, SignIn, Address

urlpatterns = [
    path('/signup', SignUp.as_view()),
    path('/signin', SignIn.as_view()),
    path('/addresses', Address.as_view()),
]
Exemplo n.º 4
0
from django.conf.urls import patterns, include, url
from users import views

from users.views import UsersIndexView, UserShowView 
from users.views import Login, Logout, SignUp, AccountView
from django.contrib.auth.decorators import login_required

urlpatterns = patterns('',
    url('^users/$', UsersIndexView.as_view(), name = "index"),
    url('^users/(?P<pk>\d+)$', UserShowView.as_view(), name = "show"),
    url(r'^users/account/', login_required(AccountView.as_view()), name="account"),
    url(r'^users/([0-9]+)/$', 'users.views.user_page', name="user_page"),

    url(r'^login/', Login.as_view(), name="login"),
    url(r'^logout/', Logout.as_view(), name="logout"),
    url(r'^signup/', SignUp.as_view(), name="signup"),

)

Exemplo n.º 5
0
from django.urls import path

from users.views import SignUp

urlpatterns = [path('signup/', SignUp.as_view(), name='signup')]
Exemplo n.º 6
0
urlpatterns = [
    path("", include("home.urls")),
    path("accounts/", include("allauth.urls")),
    path("api/v1/", include("home.api.v1.urls")),
    path("admin/", admin.site.urls),
    path("users/", include("users.urls", namespace="users")),
    path("rest-auth/", include("rest_auth.urls")),
    path("connections/", include("connections.urls")),
    path("dashboards/", include("dashboards.urls")),
    path("posts/", include("posts.urls")),
    path("searches/", include("searches.urls")),
    path("chats/", include("chats.urls")),
    path("notifications/", include("notifications.urls")),
    path("groups/", include("groups.urls")),
    path("nearby/", include("nearby.urls")),
    path("sign-up/", view=SignUp.as_view(), name="sign-up"),
    path("confirm-code/", view=ConfirmCode.as_view(), name="confirm-code"),
    path("send-forgot-password-code/",
         view=SendForgotPasswordCode.as_view(),
         name="send-forgot-password-code"),
    path("resend-code/", view=ResendCode.as_view(), name="resend-code"),
    path("reset-password/",
         view=ResetPassword.as_view(),
         name="reset-password"),
    path("change-password/",
         view=ChangePassword.as_view(),
         name="change-password"),
    path("users-detail/", view=GetUserDetail.as_view(), name="users-detail"),
    path("edit-profile/", view=EditProfile.as_view(), name="edit-profile"),
    path("connect-social-media/",
         view=ConnectSocialMedia.as_view(),
Exemplo n.º 7
0
The `urlpatterns` list routes URLs to views. For more information please see:
    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.conf.urls.static import static
from a_pedal import settings

from django.contrib import admin
from django.urls import path, include
from users.views import Login, SignUp, GoogleLogin, GoogleSignUp

urlpatterns = [
    path('admin/', admin.site.urls),
    path('perfil/', include(('users.urls', 'users'), namespace='perfil')),
    path('login/', Login.as_view(), name='login'),
    path('signup/', SignUp.as_view(), name='signup'),
    path('authenticate_google/', GoogleLogin.as_view(), name="login_google"),
    path('sign_up_google/', GoogleSignUp.as_view(), name="sign_up_google"),
    path('punto/', include(('puntos.urls', 'puntos'), namespace='punto')),
    path('plan/', include(('planes.urls', 'planes'), namespace='plan')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemplo n.º 8
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from seeseeHOME.views import Home

from django.contrib.auth.decorators import login_required
admin.autodiscover()

from users.views import Login
from users.views import Logout
from users.views import AccountView
from users.views import SignUp

urlpatterns = patterns(
    '',
    # Examples:
    # url(r'^$', 'seeseeHOME.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'^$', Home.as_view(), name="home"),
    url(r'^login/', Login.as_view(), name="login"),
    url(r'^logout/', Logout.as_view(), name="logout"),
    url(r'^account/', login_required(AccountView.as_view()), name="account"),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^users/', include('users.urls', namespace='users')),
    url(r'^signup/', SignUp.as_view(), name="signup"),
)
Exemplo n.º 9
0
from django.urls import path
from django.contrib.auth import views as auth_views

from users.views import SignUp

urlpatterns = [
    path("signup/", SignUp.as_view(), name="signup"),
    path('login/',
         auth_views.LoginView.as_view(template_name='users/authForm.html'),
         name='login'),
    path('logout/',
         auth_views.LogoutView.as_view(template_name='users/logout.html'),
         name='logout'),
    path('password-change/',
         auth_views.PasswordChangeView.as_view(
             template_name='users/changePassword.html'),
         name='password_change'),
    path('password-change-done/',
         auth_views.PasswordChangeDoneView.as_view(
             template_name='users/changePasswordDone.html'),
         name='password_change_done'),
    path('password-reset/',
         auth_views.PasswordResetView.as_view(
             template_name='users/resetPassword.html'),
         name='password_reset'),
    path('password-reset-done/',
         auth_views.PasswordResetDoneView.as_view(
             template_name='users/resetPasswordDone.html'),
         name='password_reset_done'),
    path('password-reset-confirm/<uidb64>/<token>/',
         auth_views.PasswordResetConfirmView.as_view(
Exemplo n.º 10
0
from django.conf.urls import patterns, url

from users.views import EditUser, Login, Logout, SignUp


urlpatterns = patterns('users.views',
    url(r'^login/$', Login.as_view(), name='users_Login'),
    url(r'^logout/$', Logout.as_view(), name='users_Logout'),
    url(r'^signup/$', SignUp.as_view(), name='users_SignUp'),
    url(r'^edit/(?P<id>[0-9]+)$', EditUser.as_view(), name='users_EditUser'),
)
Exemplo 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.conf.urls import url, include
from django.contrib import admin
from rest_framework_swagger.views import get_swagger_view

from tweets.router import router as tweets_router
from users.views import SignUp, UserInfo

API_TITLE = 'Tweet API'
schema_view = get_swagger_view(title=API_TITLE)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r"^api/auth/", include("rest_auth.urls")),
    url(r"^api/v1/", include(tweets_router.urls), name='api'),
    url(r"^account/info", UserInfo.as_view(), name='userinfo'),
    url(r"^account/", SignUp.as_view(), name='singup'),
    url(r"swagger-docs/", schema_view),
]
Exemplo n.º 12
0
 def test_signup_view(self):
     view = resolve('/auth/signup/')
     self.assertEqual(view.func.__name__, SignUp.as_view().__name__)