Re: testing signal with django allauth

2024-09-25 Thread jameel saidu
Hello everyone. On Wednesday, September 25, 2024, Gabriel Soler wrote: > Hey, I finally managed to test the signal!! As it has been a complicated > and long process, I wrote an article about how to perform actions after > authentication and how to test it. > > Go to article >

Re: testing signal with django allauth

2024-09-25 Thread Gabriel Soler
Hey, I finally managed to test the signal!! As it has been a complicated and long process, I wrote an article about how to perform actions after authentication and how to test it. Go to article On Monda

Re: testing signal with django allauth

2024-09-23 Thread RANGA BHARATH JINKA
In Django, when using `TestCase` for testing views, CSRF tokens are indeed not necessary since the test client does not enforce CSRF protection. However, if you're testing forms directly (like a `ModelForm`), you generally don’t need to provide a CSRF token either, as the form itself does not direc

Re: testing signal with django allauth

2024-09-23 Thread Gabriel Soler
Hi Ranga, thanks for the response, My test log is quite simple; it is not true the form is valid, and there is a little change in the session to mark it when my function did not change. As I am using TestCase I understand that the CSRF tokens are unnecessary. Would passing the dictionary to the

Re: testing signal with django allauth

2024-09-23 Thread RANGA BHARATH JINKA
what's the error you are getting in the logs ? In Django, while writing tests for forms that require CSRF token validation (for instance, in Test-Driven Development or TDD), you can bypass the CSRF validation or simulate the behavior of submitting a valid CSRF token. Here's how you can handle CSR

Re: testing signal with django allauth

2024-09-23 Thread RANGA BHARATH JINKA
Hi, I think you have to pass csrf token while submitting the form in django. Try passing csrf token. On Mon, Sep 23, 2024 at 4:34 PM Gabriel Soler wrote: > Sorry, I did not add the code before. This is how I have my tests set up > at the moment. I cannot pass the 'form is valid' step. > > from

Re: testing signal with django allauth

2024-09-23 Thread Gabriel Soler
Sorry, I did not add the code before. This is how I have my tests set up at the moment. I cannot pass the 'form is valid' step. from django.test import TestCase,Client from django.urls import reverse, reverse_lazy from django.contrib.auth import get_user_model from .forms import StyleForm from a

testing signal with django allauth

2024-09-21 Thread Gabriel Soler
Hi all, Thanks for reading. I am at a stage where I am needing to do my testing, and its is hard! I managed to add a function after sign up and log in, using the signals of allauth. As I am trying to add my tests as I work, I have added a little change to the Session, to mark if my functions h