Re: Create database objects for unit tests

2018-12-14 Thread Alexander Lamas
Hi all, Just in case someone have the same issue, here is the solution. from django.db import migrations, connection import os def load_data_from_sql(apps, schema_editor): file_path = os.path.join(os.path.dirname(__file__), 'database_objects.sql') sql_script = open(file_path).read()

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

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

Re: Create database objects for unit tests

2018-12-13 Thread Alexander Lamas
Hi Jakob, Thanks for your reply. Yes, using the factory and the mocking features is definitely a nice approach. But, in this case I also want to test the end point via making a database call which it will have to have create some stored procedures. That's why I'm trying to create a mechanism

Re: Create database objects for unit tests

2018-12-13 Thread Jakob Damgaard Møller
Look at this https://factoryboy.readthedocs.io/en/latest/ tor. 13. dec. 2018 kl. 09.15 skrev Alexander Lamas < alexander.g.la...@gmail.com>: > 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