Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
31 views

Sometimes, I have many flaky test failures due to one error: ImportError: cannot import name 'task_import_events_to_db' from 'app.tasks' (unknown location) It seems the tests fail because of this ...
Vasyl Bilych's user avatar
1 vote
1 answer
62 views

I have a Model class with a series of constraints that I am attempting to test, and I am unable to get these constraints to return an IntegrityError in testing. The class is as follows: from django.db ...
dabo_tusev's user avatar
0 votes
1 answer
80 views

I am a university student, and I decided to use Django for my final year project. This means I am limited to using the University's MySQL database server. On the server, I am only allowed to have one ...
fiocotti's user avatar
0 votes
3 answers
63 views

I know this questions has already been asked, but none of the answers works for me. Whenever I try to use the client login in Django tests, it basically gets ignored and I get a redirect to the login ...
danilociaffi's user avatar
0 votes
0 answers
43 views

I'm trying to avoid code duplication so I want to import login from users/test to the ordering/test where I need to test different views that have @login_required. users/test.py User = get_user_model()...
M4rc0txt's user avatar
1 vote
1 answer
41 views

I am trying to pass request to a Django form in unittest. This is my test: def test_AddPairedStudyForm(self): self.client.force_login(self.user) request = RequestFactory().get(reverse("...
HenryM's user avatar
  • 5,801
0 votes
1 answer
37 views

I am trying to create test cases which only differ by which user is logged in. Therefore I figured defining the tests in a base class and creating sub classes which log in the user during setUp() ...
kisa's user avatar
  • 53
2 votes
0 answers
424 views

I use the django-silk to profile the APIs of my Django project (Django + DRF). Currently, I call APIs in the browser (using DRF browsable API) and then I can see the API profiling data in the silk. ...
msln's user avatar
  • 1,563
0 votes
0 answers
34 views

I'm encountering an AssertionError in my Django unit test when attempting to save a POST request to an existing list. Despite creating the list and sending the POST request successfully, the test ...
Zimzozaur's user avatar
1 vote
1 answer
290 views

I'm developing Django application and wrote a test that checks if view method acts correctly. I need to send some data in request, including the image file. In my case: def setUp(self): ... self....
InOutLake's user avatar
3 votes
1 answer
221 views

I'm trying to run Django tests but I'm encountering with this error - django.template.exceptions.TemplateSyntaxError: 'socialaccount' is not a registered tag library., but normally it have to work ...
party's user avatar
  • 99
0 votes
1 answer
110 views

I'd like to test files produced on the admin website by import_export.admin.ExportActionMixin in Django. In particular I'd like to test the admin command by looking into the file (which I download on ...
NSS's user avatar
  • 37
1 vote
1 answer
122 views

I have django function, that takes JSON-data from request, validates it and save to db. I want to test this func, but POST request doesn’t work, error ‘json.decoder.JSONDecodeError: Expecting value: ...
Андрей's user avatar
0 votes
1 answer
101 views

I want the following test to pass, but I am always getting a 404 Error. But I would expect the "get all" request to return all users. import json from django.test.utils import ...
KIC's user avatar
  • 6,069
0 votes
1 answer
50 views

I have an issue, some data are missing in my serializer (in validate and create functions). My Model: class PostsImage(models.Model): image = models.ImageField(upload_to="posts/images") ...
darkvodka's user avatar
  • 333
2 votes
2 answers
1k views

I am writing automated tests in Django and started writing tests for an API endpoint that supports the put method. I am making my put request like so: response = self.client.put(path, data=json.dumps({...
Amir Kooshky's user avatar
1 vote
1 answer
32 views

I'm writing tests for locallibrary app following the tutorial on MDN. Both classes that test views share similar login code, but it only works in one class I tried finding spelling errors and comping ...
rad2's user avatar
  • 11
1 vote
1 answer
483 views

I need to add a custom header to the APIClient for a test. I have tried to follow this section of the official docs from rest_framework.test import APIClient client = APIClient() client.credentials(...
import_sarcasm's user avatar
0 votes
1 answer
235 views

I have test.py from rest_framework.test import APITestCase from django.core.files.uploadedfile import SimpleUploadedFile from django.urls import reverse class PostImageTest(APITestCase): def ...
Srivatsa's user avatar
  • 106
0 votes
1 answer
55 views

models.py class Major(models.Model): major = models.CharField(max_length=50, unique=True) description = models.TextField() image = models.ImageField(default='default_pics/default_major.jpg'...
Dylan Bergmann's user avatar
1 vote
0 answers
149 views

I'm trying to implement factory boy and wagtail factories to generate tests for the blog section of my site, at /blog/, which uses Wagtail CMS. However, I'm getting a 404 error when doing self....
user3605767's user avatar
1 vote
3 answers
819 views

I am writing tests for class-based views in the django project I am writing as part of a course. Currently, I am stuck trying trying to test a view that directs to an edit page that requires a user to ...
ClubShrimp's user avatar
0 votes
1 answer
441 views

For context, when one wants to change settings in a test (yes, it's ok to change it there), we can use override_settings() or modify_settings() (as observed here). That works when running the tests in ...
Tiago Peres's user avatar
  • 15.9k
0 votes
1 answer
218 views

I use django-minio-backend in order to integrate Django and Minio. I want to create a test bucket for created media files during tests running. I tried to do that in a custom test runner as follows: ...
msln's user avatar
  • 1,563
3 votes
2 answers
746 views

I have a tests in my Django app. They're working well, but i want to disable showing console logging like .Bad Request: /api/v1/users/register/ One of my tests code def ...
NelttjeN's user avatar
  • 100

1
2 3 4 5
25