def test_siren_search_with_periodic_list(): request = api.siren(q=Criteria.Periodic( Criteria.Field('activitePrincipaleUniteLegale', '84.23Z'), Criteria.Field('activitePrincipaleUniteLegale', '86.21Z'))) assert request.url == base_siren_url + '/?q=periode(activitePrincipaleUniteLegale:84.23Z AND activitePrincipaleUniteLegale:86.21Z)'
def test_siren_search_exact_field(api, execute_request): request = api.siren( q=Criteria.Periodic(Criteria.FieldExact('denominationUniteLegale','LE TIMBRE')) ) assert request.url == base_siren_url + '?q=periode(denominationUniteLegale:"LE TIMBRE")' execute_request(request)
def test_siren_search_with_periodic_list_and_operators_excluding(): request = api.siren( q=Criteria.Periodic( Criteria.Field('activitePrincipaleUniteLegale', '84.23Z') | Criteria.Field('activitePrincipaleUniteLegale', '86.21Z')) & Criteria.PeriodicField('activitePrincipaleUniteLegale', '87.21Z')) assert request.url == base_siren_url + '/?q=periode(activitePrincipaleUniteLegale:84.23Z OR activitePrincipaleUniteLegale:86.21Z) AND periode(activitePrincipaleUniteLegale:87.21Z)'
def test_siret_search_with_periodic_list(execute_request): request = api.siret( q=Criteria.Periodic( Criteria.Field('activitePrincipaleEtablissement','84.23Z'), Criteria.Field('etatAdministratifEtablissement','A') ) ) assert request.url == base_siret_url + '?q=periode(activitePrincipaleEtablissement:84.23Z AND etatAdministratifEtablissement:A)' execute_request(request)
def test_siret_search_with_periodic_list_and_operators_excluding(execute_request): request = api.siret( q= Criteria.Periodic( Criteria.Field('activitePrincipaleEtablissement','84.23Z') | Criteria.Field('activitePrincipaleEtablissement','86.21Z') ) & Criteria.PeriodicField('etatAdministratifEtablissement','A') ) assert request.url == base_siret_url + '?q=periode(activitePrincipaleEtablissement:84.23Z OR activitePrincipaleEtablissement:86.21Z) AND periode(etatAdministratifEtablissement:A)' execute_request(request)
def test_siret_search_with_periodic_list_with_or(execute_request): request = api.siret( q=Criteria.Periodic( Criteria.Field('activitePrincipaleEtablissement','84.23Z'), Criteria.Field('activitePrincipaleEtablissement','86.21Z'), Criteria.Field('activitePrincipaleEtablissement','87.21Z'), operator = 'OR' ) ) assert request.url == base_siret_url + '?q=periode(activitePrincipaleEtablissement:84.23Z OR activitePrincipaleEtablissement:86.21Z OR activitePrincipaleEtablissement:87.21Z)' execute_request(request)