Skip to content

Commit

Permalink
dbaas: handle ca certificates as base64 encoded (digitalocean#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
nanzhong authored Apr 30, 2021
1 parent ef61774 commit e599b51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ type Database struct {

// DatabaseCA represents a database ca.
type DatabaseCA struct {
Certificate string `json:"certificate"`
Certificate []byte `json:"certificate"`
}

// DatabaseConnection represents a database connection
Expand Down
4 changes: 2 additions & 2 deletions databases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestDatabases_GetCA(t *testing.T) {
body := `
{
"ca": {
"certificate": "fake_ca_cert"
"certificate": "ZmFrZQpjYQpjZXJ0"
}
}
`
Expand All @@ -183,7 +183,7 @@ func TestDatabases_GetCA(t *testing.T) {

got, _, err := client.Databases.GetCA(ctx, dbID)
require.NoError(t, err)
require.Equal(t, &DatabaseCA{Certificate: "fake_ca_cert"}, got)
require.Equal(t, &DatabaseCA{Certificate: []byte("fake\nca\ncert")}, got)
}

func TestDatabases_Create(t *testing.T) {
Expand Down

0 comments on commit e599b51

Please sign in to comment.