tests/apps/github_integration/api/test_event_subscription.py
def create_github_headers():
    """Dictionary get sorted when we retrieve the body, account for this"""

    def sort_dict(original_dict):
        res = OrderedDict()
        for k, v in sorted(original_dict.items()):
            if isinstance(v, dict):
                res[k] = dict(sort_dict(v))
            else:
                res[k] = v
        return dict(res)

    def wrapper(data, event="ping", is_json_data=True):
        if is_json_data:
            request_body = json.dumps(sort_dict(data)).encode("utf-8")
        else:
            request_body = urlencode(data).encode("utf-8")
        sig = calculate_signature(GITHUB_SIGNING_SECRET, request_body)
        return {"X-Hub-Signature": sig, "X-GitHub-Event": event}

    return wrapper
Dictionary get sorted when we retrieve the body, account for this
Dictionary get sorted when we retrieve the body, account for this
Dictionary get sorted when we retrieve the body account for this
def create_github_headers():
    def sort_dict(original_dict):
        res = OrderedDict()
        for k, v in sorted(original_dict.items()):
            if isinstance(v, dict):
                res[k] = dict(sort_dict(v))
            else:
                res[k] = v
        return dict(res)
    def wrapper(data, event="ping", is_json_data=True):
        if is_json_data:
            request_body = json.dumps(sort_dict(data)).encode("utf-8")
        else:
            request_body = urlencode(data).encode("utf-8")
        sig = calculate_signature(GITHUB_SIGNING_SECRET, request_body)
        return {"X-Hub-Signature": sig, "X-GitHub-Event": event}
    return wrapper
def create_github_headers ( ) : def sort_dict ( original_dict ) : res = OrderedDict ( ) for k , v in sorted ( original_dict . items ( ) ) : if isinstance ( v , dict ) : res [ k ] = dict ( sort_dict ( v ) ) else : res [ k ] = v return dict ( res ) def wrapper ( data , event = "ping" , is_json_data = True ) : if is_json_data : request_body = json . dumps ( sort_dict ( data ) ) . encode ( "utf-8" ) else : request_body = urlencode ( data ) . encode ( "utf-8" ) sig = calculate_signature ( GITHUB_SIGNING_SECRET , request_body ) return { "X-Hub-Signature" : sig , "X-GitHub-Event" : event } return wrapper
Dictionary get sorted when we retrieve the body, account for this
Dictionary get sorted when we retrieve the body account for this
"""Dictionary get sorted when we retrieve the body, account for this"""