def test_should_not_return_not_synchronization_compatible_product( self, app): valid_isbn = "1111111111111" ProductFactory( idAtProviders=valid_isbn, subcategoryId=subcategories.LIVRE_PAPIER.id, isSynchronizationCompatible=False, ) existing_product = find_active_book_product_by_isbn(valid_isbn) assert existing_product is None
def test_should_return_nothing_when_non_existing_isbn_is_given(self, app): # Given invalid_isbn = "99999999999" valid_isbn = "1111111111111" product = create_product_with_thing_type( id_at_providers=valid_isbn, thing_type=ThingType.LIVRE_EDITION) repository.save(product) # When existing_product = find_active_book_product_by_isbn(invalid_isbn) # Then assert existing_product is None
def test_should_not_return_not_gcu_compatible_product(self, app): # Given valid_isbn = "1111111111111" product = create_product_with_thing_subcategory( id_at_providers=valid_isbn, thing_subcategory_id=subcategories.LIVRE_PAPIER.id, is_gcu_compatible=False) repository.save(product) # When existing_product = find_active_book_product_by_isbn(valid_isbn) # Then assert existing_product is None
def test_should_not_return_not_gcu_compatible_product(self, app): # Given valid_isbn = "1111111111111" product = create_product_with_thing_type( id_at_providers=valid_isbn, thing_type=ThingType.LIVRE_EDITION, is_gcu_compatible=False) repository.save(product) # When existing_product = find_active_book_product_by_isbn(valid_isbn) # Then assert existing_product is None
def test_should_return_nothing_when_non_existing_isbn_is_given(self, app): # Given invalid_isbn = "99999999999" valid_isbn = "1111111111111" product = create_product_with_thing_subcategory( id_at_providers=valid_isbn, thing_subcategory_id=subcategories.LIVRE_PAPIER.id, ) repository.save(product) # When existing_product = find_active_book_product_by_isbn(invalid_isbn) # Then assert existing_product is None
def __next__(self) -> List[ProvidableInfo]: try: self.provider_stocks = next(self.stock_data) except StopIteration: self.stock_data = self.get_provider_stock_information( self.siret, self.last_processed_isbn, self.modified_since ) self.provider_stocks = next(self.stock_data) self.last_processed_isbn = str(self.provider_stocks["ref"]) self.product = product_queries.find_active_book_product_by_isbn(self.provider_stocks["ref"]) if not self.product: return [] providable_info_offer = self.create_providable_info( Offer, f"{self.provider_stocks['ref']}@{self.siret}", datetime.utcnow() ) providable_info_stock = self.create_providable_info( Stock, f"{self.provider_stocks['ref']}@{self.siret}", datetime.utcnow() ) return [providable_info_offer, providable_info_stock]