1717
1818
1919class Vacancy (Base ):
20- __tablename__ = "vacancies "
20+ __tablename__ = "vacancy "
2121 id : Mapped [int ] = mapped_column (primary_key = True )
2222 title : Mapped [str ]
2323 description : Mapped [str ]
@@ -27,12 +27,12 @@ class Vacancy(Base):
2727 salary_from : Mapped [int ]
2828 salary_up_to : Mapped [float ]
2929 category : Mapped [JobCategory ] = mapped_column (nullable = False )
30- company_id : Mapped [int ] = mapped_column (ForeignKey ("companies .id" ))
30+ company_id : Mapped [int ] = mapped_column (ForeignKey ("company .id" ))
3131 company : Mapped ["Company" ] = relationship (back_populates = "vacancies" )
3232
3333
3434class Company (Base ):
35- __tablename__ = "companies "
35+ __tablename__ = "company "
3636 id : Mapped [int ] = mapped_column (primary_key = True )
3737 title : Mapped [str ]
3838 vacancies : Mapped [list ["Vacancy" ]] = relationship (back_populates = "company" )
@@ -51,7 +51,7 @@ def database_url(sqlite_file_path) -> str:
5151
5252@pytest .fixture (scope = "session" )
5353def create_engine (database_url ):
54- return create_async_engine (database_url , echo = True , future = True )
54+ return create_async_engine (database_url , echo = False , future = True )
5555
5656
5757@pytest .fixture (scope = "session" )
@@ -126,6 +126,10 @@ def get_vacancy_restriction() -> dict:
126126def get_vacancy_filter (get_vacancy_restriction ):
127127 return FilterCore (Vacancy , get_vacancy_restriction )
128128
129+ @pytest .fixture
130+ def get_vacancy_filter_with_join (get_vacancy_restriction ):
131+ return FilterCore (Vacancy , get_vacancy_restriction , select (Vacancy ).join (Company ))
132+
129133
130134@pytest .fixture
131135def get_custom_vacancy_filter (get_vacancy_restriction ):
@@ -170,3 +174,12 @@ def get_query(self, custom_filter):
170174 return query .join (Vacancy ).options (joinedload (Company .vacancies ))
171175
172176 return CustomFilter (Company , get_company_restriction )
177+
178+ @pytest .fixture
179+ def get_filter_passed_in_init (get_company_restriction ):
180+ return FilterCore (
181+ Company ,
182+ get_company_restriction ,
183+ select (Company ).join (Vacancy )
184+ )
185+
0 commit comments