Skip to content
checks.py 53.8 KiB
Newer Older
lopezaguilar's avatar
lopezaguilar committed
                          number=2))
    print(data.get_checks(checks='Check Response Body Containing List Containing Subscription elements',
                          number=1))
lopezaguilar's avatar
lopezaguilar committed
    print(data.get_checks(checks='Check Response Body Containing Number Of Entities',
                          entity_type="Vehicle",
                          number_entities=3))
    print(data.get_checks(checks='Check Response Body Containing Context Source Registration element',
                          csr_description='Context Source Registration'))
    print(data.get_checks(checks='Check Response Body Containing EntityTypeList element',
                          description='Json object with list of entity types with context'))
    print(data.get_checks(checks='Check Response Body Containing EntityType element',
                          description='Json object with an entity type with context'))
    print(data.get_checks(checks='Check Response Body Containing EntityTypeInfo element'))
    print(data.get_checks(checks='Check Response Body Containing AttributeList element'))
lopezaguilar's avatar
lopezaguilar committed
    print(data.get_checks(checks='Check Response Body Containing Attribute element'))
    print(data.get_checks(checks='Check Response Body Containing List Containing Context Source Registrations elements'))
    print(data.get_checks(checks='Check Response Body Type When Using Session Request',
                          type='https://uri.etsi.org/ngsi-ld/errors/BadRequestData'))
    print(data.get_checks(checks='Check Response Body Containing ProblemDetails Element Containing Type Element set to',
                          type='https://uri.etsi.org/ngsi-ld/errors/BadRequestData'))
    print(data.get_checks(checks='Check Response Body Title When Using Session Request'))
    print(data.get_checks(checks='Check Response Body Containing ProblemDetails Element Containing Title Element'))
    print(data.get_checks(checks='Check RL Response Body Containing ProblemDetails Element Containing Type Element set to',
                          type='https://uri.etsi.org/ngsi-ld/errors/BadRequestData'))
lopezaguilar's avatar
lopezaguilar committed
    print(data.get_checks(checks='Check RL Response Body Containing ProblemDetails Element Containing Title Element'))
    print(data.get_checks(checks='Check JSON Value In Response Body',
                          key="['information']['entities'][0]['type']",
                          value="Building"))
    print(data.get_checks(checks='Check Pagination Prev And Next Headers',
                          previous='</ngsi-ld/v1/csourceSubscriptions?limit=1&page=1>;rel="prev";type="application/ld+json"',
                          next='</ngsi-ld/v1/csourceSubscriptions?limit=1&page=3>;rel="next";type="application/ld+json"'))
    print(data.get_checks(checks='Check Pagination Prev And Next Headers',
                          previous='',
                          next='</ngsi-ld/v1/csourceSubscriptions?limit=1&page=3>;rel="next";type="application/ld+json"'))
    print(data.get_checks(checks='Check Pagination Prev And Next Headers',
                          previous='</ngsi-ld/v1/csourceSubscriptions?limit=1&page=1>;rel="prev";type="application/ld+json"',
                          next=''))
    print(data.get_checks(checks='Check Pagination Prev And Next Headers',
                          previous='',
                          next=''))
    print(data.get_checks(checks='Check Created Resource Set To'))
    print(data.get_checks(checks='Check Updated Resource Set To'))
    print(data.get_checks(checks='Check Updated Resources Set To',
                          number_entities=2))
lopezaguilar's avatar
lopezaguilar committed
    print(data.get_checks(checks='Check SUT Not Containing Resource',
                          status_code=404))
    print(data.get_checks(checks='Check SUT Not Containing Resources'))
    print(data.get_checks(checks='Check NotificationParams',
                          format="keyValues",
                          uri="http://my.endpoint.org/notify",
                          accept="application/json",
                          status="ok",
                          timesSent="1"))

    print()
    print(data.get_checks(checks=
                          ['Check Response Status Code',
                           'Check Response Body Containing Array Of URIs set to',
                           'Check Created Resources Set To']
                          , status_code=201))
lopezaguilar's avatar
lopezaguilar committed
    print()
    print(data.get_checks(checks='Check Response Headers Containing NGSILD-Results-Count Equals To'))
lopezaguilar's avatar
lopezaguilar committed
    # Check exceptions
    try:
        print(data.get_checks(checks='Check Response Body Containing an Attribute set to'))
    except Exception as e:
        print(e)