mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
Move fixtures to separate module in movie lister example
This commit is contained in:
parent
31dfa191f0
commit
fb3679d267
|
@ -16,6 +16,7 @@ import example.db
|
|||
import example.main
|
||||
|
||||
import settings
|
||||
import fixtures
|
||||
|
||||
import dependency_injector.containers as containers
|
||||
import dependency_injector.providers as providers
|
||||
|
@ -38,7 +39,7 @@ class CsvApplication(containers.DeclarativeContainer):
|
|||
movie_lister=movies.MoviesModule.movie_lister)
|
||||
|
||||
init_db = providers.Callable(example.db.init_csv,
|
||||
movies_data=settings.MOVIES_SAMPLE_DATA,
|
||||
movies_data=fixtures.MOVIES_SAMPLE_DATA,
|
||||
csv_file_path=settings.MOVIES_CSV_PATH,
|
||||
delimiter=',')
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import example.db
|
|||
import example.main
|
||||
|
||||
import settings
|
||||
import fixtures
|
||||
|
||||
import dependency_injector.containers as containers
|
||||
import dependency_injector.providers as providers
|
||||
|
@ -45,7 +46,7 @@ class DbApplication(containers.DeclarativeContainer):
|
|||
movie_lister=movies.MoviesModule.movie_lister)
|
||||
|
||||
init_db = providers.Callable(example.db.init_sqlite,
|
||||
movies_data=settings.MOVIES_SAMPLE_DATA,
|
||||
movies_data=fixtures.MOVIES_SAMPLE_DATA,
|
||||
database=ResourcesModule.database)
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import example.db
|
|||
import example.main
|
||||
|
||||
import settings
|
||||
import fixtures
|
||||
|
||||
import dependency_injector.containers as containers
|
||||
import dependency_injector.providers as providers
|
||||
|
@ -55,7 +56,7 @@ class DbApplication(containers.DeclarativeContainer):
|
|||
movie_lister=DbMoviesModule.movie_lister)
|
||||
|
||||
init_db = providers.Callable(example.db.init_sqlite,
|
||||
movies_data=settings.MOVIES_SAMPLE_DATA,
|
||||
movies_data=fixtures.MOVIES_SAMPLE_DATA,
|
||||
database=ResourcesModule.database)
|
||||
|
||||
|
||||
|
@ -66,7 +67,7 @@ class CsvApplication(containers.DeclarativeContainer):
|
|||
movie_lister=CsvMoviesModule.movie_lister)
|
||||
|
||||
init_db = providers.Callable(example.db.init_csv,
|
||||
movies_data=settings.MOVIES_SAMPLE_DATA,
|
||||
movies_data=fixtures.MOVIES_SAMPLE_DATA,
|
||||
csv_file_path=settings.MOVIES_CSV_PATH,
|
||||
delimiter=',')
|
||||
|
||||
|
|
8
examples/miniapps/movie_lister/fixtures.py
Normal file
8
examples/miniapps/movie_lister/fixtures.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
"""Fixtures module."""
|
||||
|
||||
|
||||
MOVIES_SAMPLE_DATA = (
|
||||
('The Hunger Games: Mockingjay - Part 2', 2015, 'Francis Lawrence'),
|
||||
('The 33', 2015, 'Patricia Riggen'),
|
||||
('Star Wars: Episode VII - The Force Awakens', 2015, 'JJ Abrams'),
|
||||
)
|
|
@ -9,9 +9,3 @@ import os
|
|||
DATA_DIR = os.path.abspath(os.path.dirname(__file__) + '/data')
|
||||
MOVIES_CSV_PATH = DATA_DIR + '/movies.csv'
|
||||
MOVIES_DB_PATH = DATA_DIR + '/movies.db'
|
||||
|
||||
MOVIES_SAMPLE_DATA = (
|
||||
('The Hunger Games: Mockingjay - Part 2', 2015, 'Francis Lawrence'),
|
||||
('The 33', 2015, 'Patricia Riggen'),
|
||||
('Star Wars: Episode VII - The Force Awakens', 2015, 'JJ Abrams'),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user