Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Francesco Bartoli
    @francbartoli
    Many thanks
    Francesco Bartoli
    @francbartoli
    Thanks for your prompt reply and fix
    Dmitry Dygalo
    @Stranger6667
    @francbartoli You are very welcome! :) The new 2.2.0 release should be available in a few minutes and will contain that fix :)
    Francesco Bartoli
    @francbartoli
    Great @Stranger6667!
    Lloyd N.
    @Kulu-M
    Hello, I have an GET endpoint which has no parameters. However when I test it, it says "AssertionError: Passing a wrong parameter should result in a 4XX status code". I don't know how I can react to such a case. Thanks for any answers, I tried it for hours.
    Lloyd N.
    @Kulu-M
    Or how could I just ignore one endpoint?
    Dmitry Dygalo
    @Stranger6667
    Hi! Could you please share the schema and your test? CLI command or Python code
    Unfortunately we don’t have a feature to exclude endpoints, only including
    Rakesh1111
    @Rakesh1111
    Hello! I am new to schemathesis, I am trying to explore more on it. I am trying to use the schemathesis runner from AWS lambda to execute results and send an email notification. When I am trying to use the Json schema file from s3 location, it says me internal error ; failed to load the schema.. instead of file from s3, if I give any open swagger file from internet, it gives the results. Could some one help or guide me what I am missing. I have allowed or given all the permission for lambda to access the objects in s3 location.
    Rakesh1111
    @Rakesh1111

    from schemathesis import runner

    I m using this approach : events = runner.prepare("http://127.0.0.1:8080/swagger.json")
    for event in events:

    # do something with event
    Rakesh1111
    @Rakesh1111
    I have placed my client swagger schema.json in AWS S3 bucket. I have tried running just the schemathesis run command with the file uri as the file object url from AWS S3 bucket location. Even it says same error “internal error : Failed to load scheme 400 ... “. Will schemathesis support to run the files from AWS S3 bucket locations ?
    Michael Okoko
    @idoko_gitlab
    From your error, it seems it can find the and read the file correctly. The problem could be with your swagger file
    Dmitry Dygalo
    @Stranger6667
    Hi ! @Rakesh1111 could you please share the complete error message without traceback? As I see it starts with 400 - messages on this stage are usually prefixed with HTTP response codes. It could be a missing header or something like this (not sure about AWS S3 behavior)
    If the error comes from the headers issue , then you can pass headers to ‘from_uri’ function as a dictionary
    Rakesh1111
    @Rakesh1111
    @idoko_gitlab : if I place the same file in the local file system under my home directory in computer, it works with same headers. If I try to place the swagger file in the AWS S3 location, with the same headers which works in above case .. it doesn’t work here
    @idoko_gitlab : in the above two cases I am using the schemathesis run command from terminal
    Rakesh1111
    @Rakesh1111
    @Stranger6667 : Failed to load schema, code 400 was returned from https://<<bucketname>>.s3-<<regionname>>.amazonaws.com/swagger2.json
    Dmitry Dygalo
    @Stranger6667
    Thanks for sharing the message. Re local file I think that if you load the schema from your file system, then the headers don’t matter - it is a different use case. The code under the hood boils down to requests.get(“...address...”) - my assumption is that you need to pass an additional Authorization header to access your bucket
    Or some query parameters
    Rakesh1111
    @Rakesh1111
    Programatically using the below approach:
    events = runner.prepare(url,
                            headers=headers,
                            checks=[not_a_server_error, response_schema_conformance], base_url=baseUrl)
    Dmitry Dygalo
    @Stranger6667
    8 replies
    Rakesh1111
    @Rakesh1111
    url Is the location of s3 file, header include accept-version, x-api-key, "Authorization": "Bearer " + token.
    Dmitry Dygalo
    @Stranger6667
    You could try to run requests.get with your url and headers, then check the response content - probably it will contain some reassigning for 400 response status. At the moment I am not able to reproduce this behavior locally - it will require some more time
    1 reply
    partizan
    @last-partizan

    Hi all.
    I'm trying to use schemathesis with pytest, making asgi_call instead of call. Should i populate my test database with data before running tests? or can i use pytest fixtures?

    I found before_process_path hook, and there is database access for populating data, but how i can use pytest fixtures there?

    3 replies
    Michael Okoko
    @idoko_gitlab
    Hi, I'm running running my tests against the all checks, but I was wondering if there's a way for it to not fail on 500 errors as long as the HTTP 500 error is documented
    4 replies
    samuel guesnier
    @samuelguesnier
    Hello everyone :)
    Can someone help me pleae ? I'd like to save all requests in cassette, but I don't know how to do that
    import requests
    import schemathesis
    from hypothesis import settings
    schema = schemathesis.from_path(path="sam.yaml",validate_schema=False,base_url="https://baseurl.com")
    
    
    
    
    
    @schema.parametrize( endpoint="/subscriptions/{subscriptionUid}/devices", method="POST")
    @settings(max_examples=1)
    def test_no_server_errors(case):
        case.query['sessionToken'] = 'ad3414b8becbb1e9'
        case.path_parameters["subscriptionUid"] = 1384
        response = case.call()  
        case.validate_response(response)
    1 reply
    samuel guesnier
    @samuelguesnier
    Maybe I must use prepare function ?
    1 reply
    samuel guesnier
    @samuelguesnier
    Another question: is it possible to pass query paramers / body on CLI ?
    Ho, I found an answer :p kiwicom/schemathesis#695
    Ramesh
    @Rameshpvg_gitlab
    Hi,
    I am new here, I just started looking at schemathesis.. Looks like a great library. I would like to explore more.
    Could somebody please show me where can I find more examples on from_file, from_path, from_dict usage.
    5 replies
    samuel guesnier
    @samuelguesnier
    Hello eveyone ! :)
    Is Schematesis is reliable enough to be used all alone for testing my API or is it only used to find corner case ?
    Another question: Schemathesis generates right data according to the schema and also wrong data ? If so, is it possible to know when Schemathesis is generating right datas ? For example: If case contain wrong data && response_code == 200 then Fail .
    4 replies
    panix
    @alex-pancho
    Question: How can I get an extended test report? So that I could run the schemathesis on my api, he did 4,000 tests, wrote that everything was ok, but what exactly was it for the tests?
    7 replies
    vkutepov
    @vkutepov
    This message was deleted
    1 reply
    vkutepov
    @vkutepov

    and one more question
    i understand that schemathesis
    not made for this
    But if I want to use it for an integration test
    if I want to call one service and then another in the same test
    can I create schema1 and schema2?
    if yes then two case fixtures should be created

    like that
    or maybe it can be split into separate fixtures

    schema1 = schemathesis.from_uri(
        "http://my_service1.stg.com:84/swagger.json"
    )
    schema2 = schemathesis.from_uri(
        "http://my_service2.stg.com:84/swagger.json"
    )
    
    
    def test_1(case1, case2):
        case1.endpoint = "/get_result"
        case1.method = "GET"
        response1 = case1.call()
    
        case2.endpoint = "/send_result"
        case2.method = "POST"
        case2.body = response1.json()
        response2 = case2.call()
    12 replies
    panix
    @alex-pancho
    вопросы
    10 replies
    Dmitry Dygalo
    @Stranger6667
    Hi all! We are gathering feedback on Schemathesis - https://forms.gle/arTf6yQEcQH8ShxHA . It will help me to make improvements to it and prioritize new features! :) It will take 5 minutes. The results are anonymous.
    Janus Troelsen
    @ysangkok
    i am having a problem where i call validate_response but it doesn't run the check that the response conforms to the schema. how do i programmatically add that check?
    matrixbot
    @matrixbot
    @janus.troelsen:matrix.org (this is also me, please tag this matrix user, i use it more)
    matrixbot
    @matrixbot
    @janus.troelsen:matrix.org oh, seems like the check wasn't running because the content-type attribute was missing... but i had to single-step through schemathesis to find out
    matrixbot
    @matrixbot
    @janus.troelsen:matrix.org reported schemathesis/schemathesis#816
    1 reply
    arvidj
    @arvidj
    Hi, I'm trying out schemathesis in pytest. Seems useful! Is there an API documentation available somewhere? More specifically, I'm trying to add a timeout to each case generated by @schema.parametrize().
    1 reply
    arvidj
    @arvidj
    More questions:
    • is it possible to exclude certain endpoints (in pytest or using the schematest binary)
    • for one of my apis, the schematest binary just sits there with no output. I've played a around with most options (and all related to verbosity), but still no output. I tried running schematest in strace. It seems like it is stuck in an allocation loop. It's allocating more than 1gig of memory.
    5 replies
    Any ideas on how to debug that?
    matrixbot
    @matrixbot
    @janus.troelsen:matrix.org @Dimitry is there a way to totally override the strategy for an endpoint? because i found that it is spending too much time fuzzing the first endpoint. there is too much randomness, i wanna write a custom strategy that will be quickly exhausted. there is Endpoint.make_case but that is not for replacing the strategy
    1 reply
    DanielXu77
    @DanielXu77
    Hi, new to schemathesis here. I'm just wondering is there a way to provide custom TLS certificate(e.g. https://urllib3.readthedocs.io/en/latest/advanced-usage.html#custom-ssl-certificates) or choose not to verify server's TLS certificate(e.g. https://2.python-requests.org/en/master/api/#requests.Session.verify) ?
    16 replies
    matrixbot
    @matrixbot
    @janus.troelsen:matrix.org DanielXu77 (Gitter): you could probably use get_call_kwargs to pass something to the requests library that would make it ignore the certificate
    1 reply
    DanielXu77
    @DanielXu77
    Also another related question: Does schemathesis support HTTP/2 ? Is there any way to enable or force using HTTP/2 ?
    matrixbot
    @matrixbot
    @janus.troelsen:matrix.org DanielXu77 (Gitter): schemathesis works with a few HTTP providers, i believe requests is the default. so you should figure out if requests uses HTTP/2