Re: How Important Is Writing Unit Tests For Django Applications?

2022-03-13 Thread Artur Sonnenhohl
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

How Important Is Writing Unit Tests For Django Applications?

2022-03-12 Thread Daniel Coker
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

Create trigger before run unit tests

2022-02-21 Thread Alexander
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

Re: While running unit tests the wrong parser is being used.

2019-12-11 Thread Carl Nobile
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

Re: While running unit tests the wrong parser is being used.

2019-12-09 Thread José Manuel Valdivia Romero
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

While running unit tests the wrong parser is being used.

2019-11-30 Thread Carl Nobile
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

Re: Create database objects for unit tests

2018-12-14 Thread Alexander Lamas
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

Re: Create database objects for unit tests

2018-12-13 Thread Alexander Lamas
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

Re: Create database objects for unit tests

2018-12-13 Thread Александр Волков
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

Re: Create database objects for unit tests

2018-12-13 Thread Alexander Lamas
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

Re: Create database objects for unit tests

2018-12-13 Thread Jakob Damgaard Møller
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

Create database objects for unit tests

2018-12-13 Thread Alexander Lamas
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

Re: Unit tests

2018-08-26 Thread 'ju5t' via Django REST framework
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

Re: Unit tests

2018-08-22 Thread Alexander Lamas
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

Re: Unit tests

2018-08-22 Thread Jason
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

Re: Unit tests

2018-08-21 Thread Alexander Lamas
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

Re: Unit tests

2018-08-21 Thread Marc Chakiachvili
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

Unit tests

2018-08-21 Thread Alexander Lamas
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='

Re: Unit tests when using a User model

2017-05-03 Thread Fox MaSk
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

Re: Unit tests when using a User model

2017-05-02 Thread FoxMaSk
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

Re: Unit tests when using a User model

2017-05-02 Thread Tom Christie
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

Re: Unit tests when using a User model

2017-05-01 Thread Fox MaSk
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

Unit tests when using a User model

2017-05-01 Thread Tom Christie
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

Unit tests when using a User model

2017-04-29 Thread FoxMaSk
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, * -