def test_sort(self): unsorted = [ ("content-type", "2"), (":status", "1"), ("other", "4"), ("grpc-foo", "3"), ] for_wire = [ (":status", "1"), ("content-type", "2"), ("grpc-foo", "3"), ("other", "4"), ] assert sort_headers_for_wire(unsorted) == for_wire
def test_multi_sort(self): unsorted = [ ("content-type", "1"), ("te", "2"), (":status", "3"), (":authority", "4"), ("other", "5"), ("grpc-foo", "6"), ("grpc-bar", "7"), ("more", "8"), (":method", "9"), ] for_wire = [ (":status", "3"), (":authority", "4"), (":method", "9"), ("content-type", "1"), ("te", "2"), ("grpc-foo", "6"), ("grpc-bar", "7"), ("other", "5"), ("more", "8"), ] assert sort_headers_for_wire(unsorted) == for_wire
def test_empty(self): unsorted = [] for_wire = [] assert sort_headers_for_wire(unsorted) == for_wire