I understand what you mean, but imagine one example where you have a
specific function that calculates a price, with the unit tests you have the
possibility to test multiple scenarios and variables for this price
calculation, with the integration tests you can do that as well but it will
be
I understand the importance of unit testing. However, if we are going to
write integration tests (testing the views and viewset), this test will
step through all of the modules that we would otherwise unit test.
So, I'm wondering, it it really necessary to write unit test for Django
Application
Hi everyone!
Does anyone know if it is possible to create triggers before I run unit
tests?
I can create stored procedures using the following code:
Snippet
class Migration(migrations.Migration):
operations = [migrations.RunPython(load_data_from_sql)]
But, when it comes to create triggers
t; Best Regards,
>
> José Valdivia
>
> Carl Nobile schrieb am Sa., 30. Nov. 2019, 19:15:
>
>> I'm trying to run my unit tests using JSON however I'm getting this error:
>>
>> {'detail': ErrorDetail(string='XML parse error - no
Hi Carl,
I think you are using the wrong header in your request, try to use:
"Content-Type": "application/json"
Best Regards,
José Valdivia
Carl Nobile schrieb am Sa., 30. Nov. 2019, 19:15:
> I'm trying to run my unit tests using JSON however I'm
I'm trying to run my unit tests using JSON however I'm getting this error:
{'detail': ErrorDetail(string='XML parse error - not well-formed (invalid
token): line 1, column 0', code='parse_error')}
My settings are:
REST_FRAMEWORK
miter for the end of each statement inside of your sql_script
file is "^";
4. You have to clean the cache (delete all files) inside of the cache
folder, which is inside of the migration folder before run your unit tests.
*Explanation:* If you try to run all commands (sql statements) fr
Hi Александр Волков,
It's a bit hard to answer your question properly as I don't know what sort
of application you want to develop.
But for web api, please loot at the link below,
https://www.django-rest-framework.org/
they have a great documentation to help you when creating a restful web api
Hi Alexander.
I studied only python, but now I needed to write a program using the jango
rest framework. I don’t know anything about him, please tell me which
source to use (so that I’ve been told from scratch) so that I can work with
him.
Thank you very much.
--
You received this message beca
pt file to create all database objects before run the unit tests?
>>
>> I've created a "create_objects.py" file with the below code and a
>> "database_objects.sql" script file with the creation of my database stored
>> procedures.
>>
&g
cts before run the unit tests?
>
> I've created a "create_objects.py" file with the below code and a
> "database_objects.sql" script file with the creation of my database stored
> procedures.
>
> This is what I have tried so far
>
> ```
> from django.d
Hi all,
Does anyone know where and how to implement the reading and execution of a
sql script file to create all database objects before run the unit tests?
I've created a "create_objects.py" file with the below code and a
"database_objects.sql" script file with th
Although you don't need to change ALLOWED_HOSTS there is this little
function that can help in case you do need to test your settings.py.
https://docs.djangoproject.com/en/2.1/topics/testing/tools/#django.test.override_settings
It's really useful.
On Wednesday, August 22, 2018 at 1:23:07 PM UT
Thank you very much for your reply Jason!
yeah, I tested all my unit tests and yes, I've noticed that you can not
keep data to be used in the other tests.
They create their own data and settings and get cleaned up when finished.
Good learning! :)
Thank you!
Regards,
Alex
On Wednesday, A
Yes, data that's changed/inserted/deleted in a test doesn't affect other
tests. That's the whole point of self-contained tests
testing is independent of allowed_hosts, you don't need that
by default, the test environment creates the db on each test suite run.
--
You received this message beca
every time I run the unit tests?
Is there a way I can set the settings.py
#ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['testserver']
to use ALLOWED_HOST['testserver'] when I'm running the unit tests?
Should I create a dev_settings.py or a unit_test_settings.py file for thi
Hi,
Firstly, you may not name your class var with upper case, that's only an
opinion, and doesn't respond to your query.
In your test test_5_Tenant_Delete_ReturnNothing, you are actually testing
the Rest endpoint, but the ORM action of delete.
The DRF test client provide already methods to test
Hi All,
How can I make a CRUD (GET, POST, DELETE, UPDATE) unit testing for a model
class
Here is my sample. I'm struggling with the update and delete
MODEL
from django.db import models
class Tenant(models.Model):
Name = models.CharField(max_length=200, null=False, default='',
db_column='
s 'default'...
>
> How do I set permissions to the user that will fit the
> DjangoModelPermissions requirements ??
>
> Regards
>
> Le samedi 29 avril 2017 22:32:46 UTC+2, FoxMaSk a écrit :
>>
>> Hi,
>>
>> As I'm totally new with DRF, and jus
my first project with it, I
> dont see from which side I can take the code to make my unit tests.
>
> I read http://www.django-rest-framework.org/api-guide/testing/
>
> And if I start from the beginning with
>
>
>- *APIRequestFactory, *
> - with "Creating te
Not sure, but start by removing the "enforce_csrf_checks=True" from your
test case.
That's almost certainly not what you want.
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails fro
Hi Tom,
thanks for your reply
When using http://www.django-rest-framework.org/api-guide/testing/#apiclient
with force_authenticated() now I got :
File
"/home/foxmask/DjangoVirtualEnv/orotangi/orotangi/orotangi/api/test.py",
line 48, in test_create_book
self.assertEqual(response.status_code
Use APIclient, and use .autuenticate(user)
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-rest-framework+unsubscr...@googlegroups.com.
For more
Hi,
As I'm totally new with DRF, and just started my first project with it, I
dont see from which side I can take the code to make my unit tests.
I read http://www.django-rest-framework.org/api-guide/testing/
And if I start from the beginning with
- *APIRequestFactory, *
-
24 matches
Mail list logo