All Questions
706
questions
0
votes
0
answers
29
views
Django Internationalization test error:Couldn't retrieve redirection page
I wrote a blog project in Django,in some pages i used loginrequierdmixin to make sure user is loged in but in test i got error
test:
def test_get_profile_unauthenticated(self):
response = ...
1
vote
1
answer
30
views
Django session in tests
everyone!
I can't figure out how the sessions work in Django.
I have a shop, an anonymous user's shopping cart is bound to session_key.
The session key is taken from the request object.
def ...
0
votes
0
answers
24
views
Why 'coverage' considers all of my class-based-views as tested?
I'm just learning django testing.
When I use 'Coverage' module to check which parts of my code is tested, it considers almost all of class-based-views as tested while I have commented out all of my ...
0
votes
1
answer
33
views
AssertionError while testing forms.py in Django
I tried to test forms.py in Django which has LeadForm class.
Here, is the models.py
class Lead(TimestampedModel):
"""leads for LIVE courses"""
course = models....
0
votes
0
answers
23
views
testing django oauth2_provider authentication endpoint
I need to test o/token endpoint of the oauth2_provider. I wrote the test in pytest. I think I considered every thing but I get invalid_client error.
The code:
factory:
class UserApplicationFactory(...
1
vote
1
answer
28
views
DRF test user sign-in, error inactive user
I have view for authentfication:
class UserViewSet(viewsets.ViewSet):
@method_decorator(sensitive_variables("password"))
@action(url_path="sign-in", detail=False, methods=[&...
0
votes
1
answer
46
views
Mock patching an endpoint unittest that makes several requests to third party
I have a single endpoint written using django ninja. This endpoint executes a crawler that performs several requests. The sequence of requests has 3 different routines depending on whether or not the ...
0
votes
0
answers
44
views
Django Token authentication failure: Authentication credentials were not provided
I am working on the user logic of my Django project. Despite the fact that logout (using session cookie authentication) works perfectly fine in the browser, it is not working during testing for some ...
-1
votes
1
answer
56
views
Django test TypeError: Field 'id' expected a number but got ()
I got this error 3 times in my code. I searched on other question and I didn't find anything that worked.
Does anyone have any idea?
Thank you.
models.py
class Exam(models.Model):
code = models....
-1
votes
2
answers
52
views
AssertionError: 404 != 200 in django testing
I have test code, but it displays error:
self.assertEquals(response.status_code, 200)
AssertionError: 404 != 200
class TestViews(TestCase):
def setUp(self):
self.client = Client()
...
0
votes
0
answers
31
views
Creating a model through the admin panel inside the test
I'm new to Python. I'm trying to create a test that will create an item inside the admin panel, but when I run the test I get: AssertionError: False is not true.
Help me please
class ItemAdminTest(...
0
votes
1
answer
42
views
How to test a view in Django
I am learning basics of Django following official tutorial and adding some new features to my application. So I added a view that can nullify all votes of particular question
def nullask(request, ...
0
votes
1
answer
63
views
Email test does not work in Django if django-allauth sends the email
I use the Django 5.0.1 with django-allauth. With real smtp email backend, email confirmation works. Django's email testing features are also working if django-allauth is not involved, like in the ...
0
votes
1
answer
65
views
Django returning status code 400 with error message from test
I'm trying to run tests from my DJango app, but I'm getting
FAIL: test_login (authentication.tests.AuthTestCase)
line 32, in test_login
self.assertEqual(response.status_code, 200)
AssertionError: ...
0
votes
0
answers
41
views
Django parameterized tests - Problems
I want to test my Django app. To avoid code clones, i want to usere paramerezided testes. I also want to use variables i initialized in the setUp(), to avoid hardcoding e.g. primary keys.
But i did ...