This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3conf_test.go
63 lines (49 loc) · 2.53 KB
/
s3conf_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
// These are not complete tests of all functions in elixir. New tests should
// be added as the code is updated.
type S3ConfTests struct {
suite.Suite
}
func TestS3ConfTestSuite(t *testing.T) {
suite.Run(t, new(S3ConfTests))
}
func (suite *S3ConfTests) SetupTest() {}
func (suite *S3ConfTests) TearDownTest() {}
//nolint:goconst
func (suite *S3ConfTests) TestGetS3ConfigMap() {
// variable values
token := "tokenvaluestring"
inboxHost := "s3://inboxHost"
user := "s3user"
// static values
checkSslCertificate := "False"
checkSslHostname := "False"
encoding := "UTF-8"
encrypt := "False"
guessMimeType := "True"
humanReadableSizes := "True"
chunkSize := 50
useHTTPS := "True"
socketTimeout := 30
s3conf := getS3ConfigMap(token, inboxHost, user)
assert.Equal(suite.T(), user, s3conf["access_key"], fmt.Sprintf("access_key should be %v", user))
assert.Equal(suite.T(), user, s3conf["secret_key"], fmt.Sprintf("secret_key should be %v", user))
assert.Equal(suite.T(), token, s3conf["access_token"], fmt.Sprintf("access_token should be %v", token))
assert.Equal(suite.T(), checkSslCertificate, s3conf["check_ssl_certificate"], fmt.Sprintf("check_ssl_certificate should be %v", checkSslCertificate))
assert.Equal(suite.T(), checkSslHostname, s3conf["check_ssl_hostname"], fmt.Sprintf("check_ssl_hostname should be %v", checkSslHostname))
assert.Equal(suite.T(), encoding, s3conf["encoding"], fmt.Sprintf("encoding should be %v", encoding))
assert.Equal(suite.T(), encrypt, s3conf["encrypt"], fmt.Sprintf("encrypt should be %v", encrypt))
assert.Equal(suite.T(), guessMimeType, s3conf["guess_mime_type"], fmt.Sprintf("guess_mime_type should be %v", guessMimeType))
assert.Equal(suite.T(), inboxHost, s3conf["host_base"], fmt.Sprintf("host_base should be %v", inboxHost))
assert.Equal(suite.T(), inboxHost, s3conf["host_bucket"], fmt.Sprintf("host_bucket should be %v", inboxHost))
assert.Equal(suite.T(), humanReadableSizes, s3conf["human_readable_sizes"], fmt.Sprintf("human_readable_sizes should be %v", humanReadableSizes))
assert.Equal(suite.T(), fmt.Sprintf("%v", chunkSize), s3conf["multipart_chunk_size_mb"], fmt.Sprintf("multipart_chunk_size_mb should be %v", chunkSize))
assert.Equal(suite.T(), useHTTPS, s3conf["use_https"], fmt.Sprintf("use_https should be '%v'", useHTTPS))
assert.Equal(suite.T(), fmt.Sprintf("%v", socketTimeout), s3conf["socket_timeout"], fmt.Sprintf("socket_timeout should be %v", socketTimeout))
}