def create_testing_city(app): with app.app_context(): city_service = CityService(app) city = City() city.title = 'Пенза' city.title_with_preposition = 'в Пензе' city.region = 'Пензенская область' city.country = 'RU' created_city = city_service.create(city) return created_city.id
def test_city_get_with_title_part(app): with app.app_context(): city_service = CityService(app) city = City() city.title = 'Пенза' city.title_with_preposition = 'в Пензе' city.region = 'Пензенская область' city.country = 'RU' city_service.create(city) cities_like_penza = city_service.get_by_title_like('Пенз') assert len(cities_like_penza) > 0 cities_like_penza = city_service.get_by_title_like('пенз') assert len(cities_like_penza) > 0 cities_like_zarechny = city_service.get_by_title_like('Заречный') assert len(cities_like_zarechny) == 0
country_name = Translation.objects(key="france")[0] except Exception as e: country_name = Translation(key="france", names={"fr-FR": "France"}) country_name.save() city_name = Translation() city_name.names["fr-FR"] = "Londres" city_name.key = "london" country = Country() country.name = country_name city = City() city.name = city_name city.zipcode = "42154" city.country = country address = Address() address.city = city address.address = "321 General Leclerc avenue" desc = Translation() desc.names["fr-FR"] = "Meilleure entreprise ever" desc.key = "desc_best_corp" pack = Pack(pack_type="Exclusive") corp = Corporation() corp.name = "Restaurant le 59" corp.account = account corp.address = address