Debian Codegraph @

pkg/cors/cors_test.go

raw symbols SCIP
1 /*
2 * MinIO Go Library for Amazon S3 Compatible Cloud Storage
3 * Copyright 2015-2024 MinIO, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package corsscip-go gomod github.com/minio/minio-go/v7 . `github.com/minio/minio-go/v7/pkg/cors`/
19
20 import (
21 "bytesscip-go gomod github.com/golang/go/src go1.25 bytes/"
22 "osscip-go gomod github.com/golang/go/src go1.25 os/"
23 "testingscip-go gomod github.com/golang/go/src go1.25 testing/"
24 )
25
26 func TestCORSXMLMarshalscip-go gomod github.com/minio/minio-go/v7 . `github.com/minio/minio-go/v7/pkg/cors`/TestCORSXMLMarshal().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
27 fileContents, err := osscip-go gomod github.com/golang/go/src go1.25 os/.ReadFilescip-go gomod github.com/golang/go/src go1.25 os/ReadFile().("testdata/example.xml")
28 if err != nil {
29 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
30 }
31 c, err := ParseBucketCorsConfigscip-go gomod github.com/minio/minio-go/v7 . `github.com/minio/minio-go/v7/pkg/cors`/ParseBucketCorsConfig().(bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.25 bytes/NewReader().(fileContents))
32 if err != nil {
33 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
34 }
35 remarshalled, err := c.ToXMLscip-go gomod github.com/minio/minio-go/v7 . `github.com/minio/minio-go/v7/pkg/cors`/Config#ToXML().()
36 if err != nil {
37 t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err)
38 }
39 trimmedFileContents := bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.TrimSpacescip-go gomod github.com/golang/go/src go1.25 bytes/TrimSpace().(fileContents)
40 if !bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.Equalscip-go gomod github.com/golang/go/src go1.25 bytes/Equal().(trimmedFileContents, remarshalled) {
41 t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("got: %s, want: %s", string(remarshalled), string(trimmedFileContents))
42 }
43 }