(t *testing.T)
| 793 | } |
| 794 | |
| 795 | func TestAuthQueryRewriting(t *testing.T) { |
| 796 | sch, err := os.ReadFile("../e2e/auth/schema.graphql") |
| 797 | require.NoError(t, err, "Unable to read schema file") |
| 798 | |
| 799 | jwtAlgo := []string{jwt.SigningMethodHS256.Name, jwt.SigningMethodRS256.Name} |
| 800 | |
| 801 | for _, algo := range jwtAlgo { |
| 802 | result, err := testutil.AppendAuthInfo(sch, algo, "../e2e/auth/sample_public_key.pem", false) |
| 803 | require.NoError(t, err) |
| 804 | strSchema := string(result) |
| 805 | |
| 806 | authMeta, err := authorization.Parse(strSchema) |
| 807 | require.NoError(t, err) |
| 808 | |
| 809 | metaInfo := &testutil.AuthMeta{ |
| 810 | PublicKey: authMeta.VerificationKey, |
| 811 | Namespace: authMeta.Namespace, |
| 812 | Algo: authMeta.Algo, |
| 813 | ClosedByDefault: authMeta.ClosedByDefault, |
| 814 | } |
| 815 | |
| 816 | b := read(t, "auth_query_test.yaml") |
| 817 | t.Run("Query Rewriting "+algo, func(t *testing.T) { |
| 818 | queryRewriting(t, strSchema, metaInfo, b) |
| 819 | }) |
| 820 | |
| 821 | t.Run("Mutation Query Rewriting "+algo, func(t *testing.T) { |
| 822 | mutationQueryRewriting(t, strSchema, metaInfo) |
| 823 | }) |
| 824 | |
| 825 | b = read(t, "auth_add_test.yaml") |
| 826 | t.Run("Add Mutation "+algo, func(t *testing.T) { |
| 827 | mutationAdd(t, strSchema, metaInfo, b) |
| 828 | }) |
| 829 | |
| 830 | b = read(t, "auth_update_test.yaml") |
| 831 | t.Run("Update Mutation "+algo, func(t *testing.T) { |
| 832 | mutationUpdate(t, strSchema, metaInfo, b) |
| 833 | }) |
| 834 | |
| 835 | b = read(t, "auth_delete_test.yaml") |
| 836 | t.Run("Delete Query Rewriting "+algo, func(t *testing.T) { |
| 837 | deleteQueryRewriting(t, strSchema, metaInfo, b) |
| 838 | }) |
| 839 | } |
| 840 | } |
| 841 | |
| 842 | func TestAuthQueryRewritingWithDefaultClosedByFlag(t *testing.T) { |
| 843 | sch, err := os.ReadFile("../e2e/auth/schema.graphql") |
nothing calls this directly
no test coverage detected