Obviously. You need to know how your routers generate the URL endpoint.
After reading DRF, my best guess would be either 'courses-list' or
'course-list'.
On Tuesday 26 March 2024 at 19:33:07 UTC+8 Filbert wrote:
> *sigh* same error:
> django.urls.exceptions.NoReverseMatch: Reverse for* 'courses
Check your url. This error usually show up when there's no url with the
name provided for the reverse function
On Tue, Mar 26, 2024, 11:55 AM Filbert wrote:
> Consider this what seems to be a simple Django/DRF API which works:
>
> class CourseViewSet(viewsets.ModelViewSet):
> queryset = Cours
Use "basename" parameter while registering router.
router.register(r'courses', CourseViewSet, basename="courses")
And then reverse using this basename and operation like "courses-list".
On Tue, 26 Mar, 2024, 17:03 Filbert, wrote:
> *sigh* same error:
> django.urls.exceptions.NoReverseMatch: Re
*sigh* same error:
django.urls.exceptions.NoReverseMatch: Reverse for* 'courses-create' *not
found. 'courses-create' is not a valid view function or pattern name.
On Tuesday, March 26, 2024 at 7:28:45 AM UTC-4 Muhammad Juwaini Abdul
Rahman wrote:
> It's not reverse('courses') alone. Probably re
It's not reverse('courses') alone. Probably reverse('courses-create') or
something like that.
On Tue, 26 Mar 2024 at 18:55, Filbert wrote:
> Consider this what seems to be a simple Django/DRF API which works:
>
> class CourseViewSet(viewsets.ModelViewSet):
> queryset = Course.objects.all()
>
Consider this what seems to be a simple Django/DRF API which works:
class CourseViewSet(viewsets.ModelViewSet):
queryset = Course.objects.all()
serializer_class = CourseSerializer
router = DefaultRouter()
router.register(r'courses', CourseViewSet)
urlpatterns = [
path('', include(router.u
d to modify the test script?
> Thanks for your help.
>
> Le mercredi 13 février 2019 à 10:54:04 UTC+1, Anton Melser a écrit :
>
>> When you use django unittests commit is made as no-op. Use --keepdb and
>>> at the end of your tests run SQL commit against your database cursor
HelloI am running into the same problem but I do not understand what needs
to be done. I use keepdb but how can I get the database cursor connection.
Do I need to modify the test script?
Thanks for your help.
Le mercredi 13 février 2019 à 10:54:04 UTC+1, Anton Melser a écrit :
> When you
Hi group
I am reaching out to try and ask for django common issues.
Can't see your comments on the group. can you help me?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
got some issues in unit test in django,could anypone have a look
On Monday, September 25, 2023 at 7:28:31 PM UTC+5:45 Simon Connah wrote:
> Thank you very much!
>
> --- Original Message ---
>
> On Monday, September 25th, 2023 at 14:07, Muhammad Juwaini Abdul Rahman <
Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users
> wrote:
>
> > I can write a unit test which checks say the title on a page and compares
> > it to a string but that is really prone to breakage. What I want to do
> > instead is to check that the templat
Use assertTemplateUsed.
https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
On Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users <
django-users@googlegroups.com> wrote:
> I can write a unit test which checks say
I can write a unit test which checks say the title on a page and compares it to
a string but that is really prone to breakage. What I want to do instead is to
check that the template that is returned by the URL is the same one that is
expected in the unit test. Is there an easy way to do this
when i am running the test its storing the inner functional data to main db
not test db why ?
On Monday, January 9, 2023 at 2:32:20 PM UTC+5:30 sencer...@gmail.com wrote:
> Hi,
>
> I try to get coverage reports using a simple django model.
> Unit test for model was written but repor
My async CBV works when accessed through my url endpoint with REQUESTS
package. But with the django test client it seems to think the database
doesn't contain the information I'm trying to pull using ORM. I've
confirmed that the data DOES exist in the newly recreated DB (
Yes. All migrations have been done.
On Tue, Jun 7, 2022, 9:01 AM Sebastian Jung
wrote:
> Do you have make manage.py migrate and afzer this manage.py makemigrations?
>
> Mark Phillips schrieb am Di., 7. Juni 2022,
> 17:02:
>
>> I can't seem to be able to create a t
Hi
Why do not you use mock for data base
?
If you use mock data base you do not need test data base and your data base
will not be change
On Tue, 7 Jun 2022, 7:32 pm Mark Phillips,
wrote:
> I can't seem to be able to create a test database for my django project. I
> get
Do you have make manage.py migrate and afzer this manage.py makemigrations?
Mark Phillips schrieb am Di., 7. Juni 2022,
17:02:
> I can't seem to be able to create a test database for my django project. I
> get this error:
>
> django.db.utils.ProgrammingErr
I can't seem to be able to create a test database for my django project. I
get this error:
django.db.utils.ProgrammingError: (1146, "Table
'test_hopi_django.CurrentArticle' doesn't exist")
I have full details at
https://stackoverflow.com/questions/72521409/cant-
Hi all,
how test the urls in django rest , i need each url response how to write
one file for each url response
need to write a URL in our application, which will return working or
something as a response ?
* not test cases
--
You received this message because you are subscribed to the
t 2:15 PM Sebastian Jung <
>>>>> sebastian.ju...@gmail.com> wrote:
>>>>>
>>>>>> Hey salima,
>>>>>>
>>>>>> This error is strange. Django try to use a Relation in postgresql
>>>>>> which does
nly tip that you cam reset database. I would delete database
>>>>> in postgresql and create it new with psql tool. After this you must reset
>>>>> all migrations:
>>>>>
>>>>>
>>>>> https://simpleisbetterthancomplex.
ancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html
>>>>
>>>> And after this when you migrate it, then structure is created in new
>>>> database.
>>>>
>>>> I am sorry i have no idea how yoz can fix relation exception manual.
&g
After this you must reset all
>>> migrations:
>>>
>>>
>>> https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html
>>>
>>> And after this when you migrate it, then structure is created in new
>>> database.
>>>
n you migrate it, then structure is created in new
>> database.
>>
>> I am sorry i have no idea how yoz can fix relation exception manual.
>>
>> Regards
>>
>>
>> Salima Begum schrieb am Mi., 16. März
>> 2022, 06:51:
>>
>>> Hi al
migrate it, then structure is created in new
> database.
>
> I am sorry i have no idea how yoz can fix relation exception manual.
>
> Regards
>
>
> Salima Begum schrieb am Mi., 16. März
> 2022, 06:51:
>
>> Hi all,
>> After writing test cases I run test cases
x.com/tutorial/2016/07/26/how-to-reset-migrations.html
And after this when you migrate it, then structure is created in new
database.
I am sorry i have no idea how yoz can fix relation exception manual.
Regards
Salima Begum schrieb am Mi., 16. März 2022,
06:51:
> Hi all,
> After writing
Hi all,
After writing test cases I run test cases I am getting an error below
```
Python manage.py behave
```
After running the above command I am getting this error.
```
Creating test database for alias 'default'...
Got an error creating the test database: database "test_newDa
Hi Team,
I am writing some django test-cases, there are multiple test-cases are
failing inside view or models, but I am not getting exact root cause for
those failure,
Could you please suggest me any tool which is used to debug the django unit
test cases, Also if you can share my some good
a 3.2.10 installation and haven’t run my unit tests in a long
> time. When I try now, I get a failure which seems to trace back to the test
> runner itself:
>
> TypeError: Unknown option(s) for check command: databases. Valid options
> are: all, debug, force_color, help, names, no_c
I’ve got a 3.2.10 installation and haven’t run my unit tests in a long time.
When I try now, I get a failure which seems to trace back to the test runner
itself:
TypeError: Unknown option(s) for check command: databases. Valid options are:
all, debug, force_color, help, names, no_color
Hello,
I hope I am on the right place.
I want to write some test from my async view and I follow the documentation
but it keeps failing.
this is my view:
```class Session(View):
""" Asynchronously get a session for a system."""
@classonlymethod
def as_view(cl
, client=client) return func @pytest.fixture
def create_candidate(candidate_factory): candidate = [] for _ in range(5):
can = candidate_factory.create() token, __ =
Token.objects.get_or_create(user=can.user) candidate.append(can) return
candidate **This is the test** @pytest.mark.django_db def
I am fresher In django wanna have a opportunity.can anyone help me ?
On Tue, Jul 6, 2021, 9:29 PM Yonatan Girma
wrote:
> Greetings,
>
> We are looking for Django app unit tester for small business project. Any
> person with professional experience please send resume to
> support-...@adulis.com
>
Greetings,
We are looking for Django app unit tester for small business project. Any
person with professional experience please send resume to
support-...@adulis.com
Respectfully,
Yonatan G.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To u
I want to create a system that works similar to stripe. There'll be live
API keys, as well as test API keys. I have been thinking of how to
implement this architecture, and I am not sure the best way to go about it.
I found a similar question on this but it didn't help much.
Arch
rename
> publication_url to just url since it's a part of the Publication model,
> the "publication" part is redundant.
>
>> and observed there are some inactive URLs on the production server (due to
>> data entry mistakes). Is there any way I can write a test fo
Hi django developers!
I have an issue with creating test database. I use mysql for db and docker
compose.
I have no problem running docker containers with docker-compose, but when I
run test it spits this error message.
Note that the name of django service is web, and mysql service is db
onfig).
Happy to answer more specific qs...
On Monday, March 29, 2021 at 2:59:12 AM UTC-7 Olivier wrote:
> Hello,
>
> I'm thinking about adding natural keys to a lot of existing models (Djano
> 3.1.7) to help initializing dev or prod database.
>
> 1. How best to unit test models
t" without success.
I was thinking of accessing some model dict if such exist.
2. How can I import RelatedObjectDoesNotExist errors in my code ?
3. Would you say that throwing an error when executing a simple "if
self.server_host" test is a bug (that should be reported) or not ?
Best r
Hello,
I'm thinking about adding natural keys to a lot of existing models (Djano
3.1.7) to help initializing dev or prod database.
1. How best to unit test models using natural keys ?
I was thinking of separately testing both serialization and
deserialization but would be very curio
cation model,
the "publication" part is redundant.
> and observed there are some inactive URLs on the production server (due to
> data entry mistakes). Is there any way I can write a test for the inactive
> URLs from the database (local copy)?.
I assume "inactive" here me
there any way I can write a test for the inactive
URLs from the database (local copy)?.
Thanks
Kannan
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
def render_patch(request, template, context):
> template_rendered.send(sender=self, template=template,
> context=context)
> return render(request, template, context)
>
> mock_render.side_effect = render_patch
>
> At least doing it this wa
te,
context=context)
return render(request, template, context)
mock_render.side_effect = render_patch
At least doing it this way puts all the weird stuff in my test code. I
didn't have to touch anything in my production view code (or in either
django or jinja).
On Thursday, Fe
It's a known problem. See https://code.djangoproject.com/ticket/24622. In
short, the django template code has hooks to populate these values in the
test client's response. The jinja folks (understandably) don't want to add
the same hooks.
On Friday, February 5, 2021 at 1:37:10
Hi Roy,
I haven’t been through this personally, but it strikes me as odd that the test
can’t read the request context. On the surface it would stand to reason that if
the test can’t read it, then the page wouldn’t render on browser request. Can
you post an example of one of your failing tests
I started my current project using native django templates and now I'm
converting to jinja2. For the most part, it has gone smoothly.
The surprising roadblock was that this broke all my unit tests. The issue is
that django.template.backends.jinja2.Jinja2 doesn't populate response.context.
message not posting
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://
For one of my functional tests, I decided to use unittest.TestCase instead
of a Django test class because it was convenient when cleaning up the test
to have direct access to my local development database in the test itself.
Running the test in isolation like so passes as I'd expect:
$ p
2020, at 10:08 PM, Roy Smith wrote:
>
> I have both model and social backends configured in settings.py:
>
>> AUTHENTICATION_BACKENDS = (
>> 'django.contrib.auth.backends.ModelBackend',
>> 'social_core.backends.mediawiki.MediaWiki',
>
I have both model and social backends configured in settings.py:
> AUTHENTICATION_BACKENDS = (
> 'django.contrib.auth.backends.ModelBackend',
> 'social_core.backends.mediawiki.MediaWiki',
> )
When I run this test:
> from django.
Hey, everyone. Please help me in this problem, i'm trying to test the
get_success_url method, but didn't got success.
https://stackoverflow.com/questions/61745172/how-to-test-get-success-url-in-classbasedview-for-django
--
You received this message because you are subscribed to
ion.atomic*' block.
On Tuesday, May 12, 2020 at 10:35:31 AM UTC+3, Uri Kogan wrote:
>
> The documentation states that "you cannot test that a block of code is
> executing within a transaction" while I am looking to "test a block of code
> that has a transaction&qu
The documentation states that "you cannot test that a block of code is
executing within a transaction" while I am looking to "test a block of code
that has a transaction".
In any case, the issue here is that "transaction.atomic" does not work when
nested whi
database behaviors cannot be
tested within a Django TestCase class. For instance, you cannot test that a
block of code is executing within a transaction, as is required when using
select_for_update()
<https://docs.djangoproject.com/en/3.0/ref/models/querys
le" call of django-role-permissions uses "transaction.atomic".
Which, of course, I would not want to change, as this is an external
library.
So I can't really remove usages of "transaction.atomic"
On Tuesday, May 12, 2020 at 9:48:21 AM UTC+3, Aldian Fazrihady
When testing django apps, my unit test usually accesses the django app via
django test client:
https://docs.djangoproject.com/en/3.0/topics/testing/tools/#the-test-client.
Django test client simulates http access, so my Django tests always run my
Django code starting from Django views.
Even though
ady.com
>
> Pada tanggal Sel, 12 Mei 2020 04.02, Uri Kogan > menulis:
>
>> Hello,
>>
>> I am using TestCase and trying to create an object during test.
>> There is a log activated on MySQL server, so I see all the queries being
>> executed there.
>>
>
to create an object during test.
> There is a log activated on MySQL server, so I see all the queries being
> executed there.
>
> This "transaction.atomic" sets a SAVEPOINT in the database thinking that
> the transaction is already started. The problem is that there is no
&
Hello,
I am using TestCase and trying to create an object during test.
There is a log activated on MySQL server, so I see all the queries being
executed there.
This "transaction.atomic" sets a SAVEPOINT in the database thinking that
the transaction is already started. The problem is
ame}
({field_name})",
f"DROP INDEX {index_name} ON {table_name}",
),
]
```
The __search works fine, but I use it inside a test suite it returns empty.
Any help or feedback is appreciated
Details are here
https://stackoverflow.com/questions/61486725/django-mysql-fulltext-sear
When you say "shrinking your test databases", what do you mean exactly? I'm
a bit of a newbie on that part of Django.
On Wed, Apr 1, 2020 at 8:13 PM Thomas Lockhart
wrote:
> If you are trying to optimize the test flow, then you may want to spend
> some time shrinking you
If you are trying to optimize the test flow, then you may want to spend some
time shrinking your test databases to a more manageable size. Or have two sets;
abbreviated and full, with the larger one to exercise your (unknown) edge cases.
hth
- Tom
> On Apr 1, 2020, at 2:25 AM, cool-RR wr
urrency/
>
> On Wed, 1 Apr 2020, 11:25 am cool-RR, wrote:
>
>> Hi guys,
>>
>> I'm trying to optimize our Django testing workflow.
>>
>> We have 7 different databases, and Django spends a lot of time on these
>> lines:
>>
>>
>>
ime on these
> lines:
>
>
> Creating test database for alias 'main_database'...
> Creating test database for alias 'foo_database'...
> Creating test database for alias 'bar_database'...
> Creating test database for alias 'baz_database'...
>
>
Hi guys,
I'm trying to optimize our Django testing workflow.
We have 7 different databases, and Django spends a lot of time on these
lines:
Creating test database for alias 'main_database'...
Creating test database for alias 'foo_database'...
Creating test databas
we can replicate the issue with
even this code
class Test2(TestCase):
fixtures = ['fixture.json']
def test_demo2(self):
u = User.objects.get(username='testuser1')
#Some testing
I have these two test cases and my fixture has 2 rows in total, one for the
value).quantize(quantize_value,
context=expression.output_field.context)
2120TypeError: argument must be int of float
The unit test involves adding numpy.nan (among other things) to the database
(in a models.DecimalField field) and at some point later in the test we are
querying that data and when it try's to e
Hi man,
How about pk you expect to test by declare in test.py with '/post/264, so
!= 200 in result!?
On Sun, Feb 2, 2020, 22:05 Body Abdo wrote:
> Dear all
>
> I can't do the test -error is
> self.assertEqual(response.status_code, 200)
> AssertionError: 404 != 20
Dear all
I can't do the test -error is
self.assertEqual(response.status_code, 200)
AssertionError: 404 != 200
My code is
views.py
class DetailPageView(DetailView):
model = Series
template_name='/var/www/project/tapelss/movies/archive/templates/archive/detail.html'
ur
Of course, as pure python
https://stackoverflow.com/a/10402323
Missatge de paulo milo escano del dia dg., 26
de gen. 2020 a les 16:41:
> can django support ping test, such as using subprocess module
>
> --
> You received this message because you are subscribed to the Google Grou
can django support ping test, such as using subprocess module
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.co
mands (like $ python -m pip install -e
> /path/to/your/local/clone/django/
> and $ python -m pip install -r requirements/py3.txt (no errors here) then ,..
> then after cd to tests then running this command
&
here) then
> ,..
> then after cd to tests then running this command ./runtests.py
>
ll -r requirements/py3.txt (no errors here) then
,..
then after cd to tests then running this command ./runtests.py
)
the test here is giving as res
{set-cookie:
csrftoken=dsEtx2CP6rX5bhIbRmkTOv5LmciytID5t6ShQbgNMTALTnhCoXdxWQ1TcAzxQoDO;
expires=Wed, 06 Jan 2021 17:01:00 GMT; Max-Age=31449600; Path=/;
SameSite=Lax,sessionid=2rtrkbnhc8m30iqs7sw4em014hr6a3ss; expires=Wed, 22 Jan
2020 17:01:00 GMT; HttpOnly; Max-Age=1209600; Path=/; SameSite
it worked! really appreciate the help!
On Wednesday, December 4, 2019 at 10:24:30 PM UTC+5:30, Manjunatha C wrote:
>
> Python -m venv envname
>
> Try with this command
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this gr
Python -m venv envname
Try with this command
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To view this discussion
Wrote the following
Virtualenv test
On Wed, 4 Dec 2019, 4:57 pm Hima Bindu chowdary,
wrote:
> I had created a virtualwrapper then had to create a virtual env called test
> when i ran the following command i got this :
>
> C:\Users\User>py -m pip install virtualenv test
> R
I had created a virtualwrapper then had to create a virtual env called test
when i ran the following command i got this :
C:\Users\User>py -m pip install virtualenv test
Requirement already satisfied: virtualenv in
c:\users\user\appdata\local\programs\python\python38\lib\site-packages
(16.
+ shop + "/admin/api/2019-10/webhooks.json",
data=json.dumps(payload), headers=headers) #
print(response.content)return HttpResponse('success')*
*i am writing unitest for the above function,there are some Factory and
fakers method is used. I am
Hei all,
I have an issue with a test class (APITestCase) where a function can pass
the test if it is the only function within the class, or fail, if it is one
of two or more functions.
I have put this question on Stack Overflow where it is available with nicer
formatting.
https
Thanks!, So for each test , do i need to add same test data? or do we have
any other way not to repeat the same test data?
On Tuesday, 13 August 2019 20:32:16 UTC+5:30, Vinicius Assef wrote:
>
> The database is cleared after each test method.
>
> So, in a new testcase your datab
The database is cleared after each test method.
So, in a new testcase your database is empty.
On Tue, 13 Aug 2019 at 00:34, Arulselvam K wrote:
> Have hosted the code @ "https://github.com/tbone230590/plib";
> Here is the problem I have two models Book and IssuedBook, IssuedBoo
e
available @ "/api/unit_tests/models".
I am able to test Book model successfully. But I have a test for IssuedBook
model which is referring Book model is getting failed.
It seems cause of the problem is referring Book object created in
BookTestCase that was previously run. But I dont un
On 7/08/2019 1:35 pm, Tosin Ayoola wrote:
Halo guyz, working on an e-commerce project & I rili wan write the
test for this project, hoping someone can lead me in direction to go
https://docs.djangoproject.com/en/2.2/topics/testing/
--
You received this message because you are subscribe
Halo guyz, working on an e-commerce project & I rili wan write the test
for this project, hoping someone can lead me in direction to go
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop re
Hi. I'm using Django channels in server side for a speech to text
application. When I test websocket with jmeter(+120 user or thread in 1
second), about half of requests fail. Here is my code:
class Consumer(AsyncWebsocketConsumer):
def __init__(self, *args, **k
plication registry may not be fully
> populated at this point, which could cause the ORM to malfunction.
However after doing this, running tests with ./manage.py test -k causes the
unittest loader to fail with:
ERROR: myapp.api.models (unittest.loader
Test django
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to dj
I had a similar problem and I solved it by making all tests inherit from
`django.test.TestCase`. I had some tests inheriting from
`unittest.TestCase`, which doesn't reset the database after the test is
finished.
I found the answer on https://stackoverflow.com/a/436795/6490637
Em se
Hey,
I am Gourav Sardana undergraduate computer science student.I am interested
in the idea of test framework cleanup. @Mentors Can i ask you one thing?
we have to build a software for improving code or we have to add this in
our django core code?
Regards,
Gourav Sardana
--
You received
gt;>> So question is - if I get a model object from QuerySet #1, is it
>>> possible to check if the model object is 'filtered' or fits into QuerySet
>>> #2, without actually executing the SQL for QuerySet #2 to find the record
>>> again?
>>>
>
gt;> 2) Select all records from table where color = "blue"
>>>
>>> So QuerySet #2 is more restricted than QuerySet #1
>>>
>>> So question is - if I get a model object from QuerySet #1, is it
>>> possible to check if the model object is '
;
>> So question is - if I get a model object from QuerySet #1, is it possible
>> to check if the model object is 'filtered' or fits into QuerySet #2,
>> without actually executing the SQL for QuerySet #2 to find the record again?
>>
>> I'm asking because run
re color = "blue"
>>
>> So QuerySet #2 is more restricted than QuerySet #1
>>
>> So question is - if I get a model object from QuerySet #1, is it possible to
>> check if the model object is 'filtered' or fits into QuerySet #2, without
>>
- if I get a model object from QuerySet #1, is it possible
> to check if the model object is 'filtered' or fits into QuerySet #2,
> without actually executing the SQL for QuerySet #2 to find the record again?
>
> I'm asking because running the SQL for QuerySet #2 is expen
a model object from QuerySet #1, is it possible
to check if the model object is 'filtered' or fits into QuerySet #2,
without actually executing the SQL for QuerySet #2 to find the record again?
I'm asking because running the SQL for QuerySet #2 is expensive, ideally
would test if t
No need to answer this. I'm just seeing if googlegroups sends it me.
Haven't much from the list since gmail got itself listed in SORBS the
other day - and in particular I didn't get a message I posted in the
browser.
--
You received this message because you are subscribed to the Google Groups
1 - 100 of 1336 matches
Mail list logo