<commit_before>Feature: Basic sqitch API interaction with JWT

    Background: Setup environment with JWT Auth
        Given I am a client
        And I add Headers:
            | Prefer        | return=representation |
            | Authorization | Bearer <KEY> |
        # Note that this JWT was created at http://jwt.io/#debugger-io using the payload
        # {
        #     "role": "member",
        #     "name": "<NAME>",
        #     "email": "<EMAIL>",
        #     "admin": false
        # }
        #
        # And the JWT secret D<KEY> (base64 encoded)
        # this JWT secret was generated for testing purposes using `openssl rand -base64 32`
        # the same JWT secret is specified in postgrest/config so that auth will work.
        # TODO: figure out how to share a secret between keycloak so the Elm UI can authenticate

    Scenario: Add/update a comment
        When I request to create a comment with:
            | message | string  | "The system must be tested" |
        Then the request is successful and a comment was created
        And print the response
    
    Scenario: Search for all comments
        When I request a list of comments
        Then the request is successful
        And the response is a list of at least 1 comment<commit_msg>Notes on curl extraction of keycloak JWT Signed-off-by: <NAME> <<EMAIL>><commit_after>Feature: Basic sqitch API interaction with JWT

    Background: Setup environment with JWT Auth
        Given I am a client
        And I add Headers:
            | Prefer        | return=representation |
            | Authorization | Bearer <KEY> |
        # Note that this JWT was created at http://jwt.io/#debugger-io using the payload
        # {
        #     "role": "member",
        #     "name": "<NAME>",
        #     "email": "<EMAIL>",
        #     "admin": false
        # }
        #
        # And the JWT secret D<KEY> (base64 encoded)
        # this JWT secret was generated for testing purposes using `openssl rand -base64 32`
        # the same JWT secret is specified in postgrest/config so that auth will work.
        # TODO: figure out how to share a secret between keycloak so the Elm UI can authenticate
        # here is how to get a token using curl
        # http://blog.keycloak.org/2015/10/getting-started-with-keycloak-securing.html
        # RESULT=`curl --data "grant_type=password&client_id=curl&username=user&password=password" http://localhost:8180/auth/realms/master/protocol/openid-connect/token`
        # TOKEN=`echo $RESULT | sed 's/.*access_token":"//g' | sed 's/".*//g'`

    Scenario: Add/update a comment
        When I request to create a comment with:
            | message | string  | "The system must be tested" |
        Then the request is successful and a comment was created
        And print the response
    
    Scenario: Search for all comments
        When I request a list of comments
        Then the request is successful
        And the response is a list of at least 1 comment
{'fraction_non_alphanumeric': 0.07878989361702128, 'fraction_numerical': 0.007978723404255319, 'mean_word_length': 2.150785340314136, 'pattern_counts': {'":': 9, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6796592', 'n_tokens_mistral': 835, 'n_tokens_neox': 792, 'n_words': 340}