Skip to content

Commit d097b0f

Browse files
committed
merge fixes
1 parent d9b3d51 commit d097b0f

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

cfg/aesbackend_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func TestAESBackendLoad(t *testing.T) {
106106
if err != nil {
107107
t.Fatalf("Can't parse crypto URL: %v", err)
108108
}
109-
conf, err = backend.Load(u)
109+
_, err = backend.Load(u)
110110
if err == nil || err.Error() != "encrypted configuration header not valid" {
111111
t.Errorf("Loading a non-encrypted config should error")
112112
}
@@ -125,7 +125,7 @@ func TestAESBackendSave(t *testing.T) {
125125
}
126126

127127
// Save the config file to a new absolute path using a URL
128-
p := encryptedTempConf()
128+
p = encryptedTempConf()
129129
u, err = ParseURL("crypto://" + testPassword + "@" + p)
130130
if err != nil {
131131
t.Error("cannot parse config url")
@@ -137,7 +137,7 @@ func TestAESBackendSave(t *testing.T) {
137137
backend, _ = NewAESBackend(u)
138138
err = backend.Save(c)
139139
if err != nil {
140-
t.Errorf("failed to save the config to %s. %v", newURL, err)
140+
t.Errorf("failed to save the config to %s. %v", u, err)
141141
}
142142
if !exist(p) {
143143
t.Errorf("configuration file wasn't saved to %s", p)

cfg/filebackend.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func NewFileBackend() *FileBackend {
3131
// Load loads chains from config
3232
func (fs *FileBackend) Load(u *URL) (*Config, error) {
3333
var config Config
34-
fixWinURL(u)
3534

3635
// detect file format by extension
3736
if strings.HasSuffix(u.Path, ".yaml") {

cfg/filebackend_test.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package cfg
22

33
import (
4-
<<<<<<< HEAD
54
"io/ioutil"
6-
"net/url"
7-
=======
8-
>>>>>>> :lipstick:
95
"os"
106
"path/filepath"
117
"testing"
@@ -23,11 +19,7 @@ func TestFileLoad(t *testing.T) {
2319
// try to load the config from a relative path
2420
u, err = ParseURL(filepath.Join("testdata", "beehive.conf"))
2521
if err != nil {
26-
<<<<<<< HEAD
27-
t.Error("cannot parse config path")
28-
=======
2922
t.Fatalf("Can't parse URL. %v", err)
30-
>>>>>>> Test fixes
3123
}
3224
backend = NewFileBackend()
3325
conf, err := backend.Load(u)
@@ -56,6 +48,7 @@ func TestFileLoad(t *testing.T) {
5648
}
5749

5850
func TestFileSave(t *testing.T) {
51+
tmpdir, err := ioutil.TempDir("", "beehivetest")
5952
u, err := ParseURL(filepath.Join("testdata", "beehive.conf"))
6053
if err != nil {
6154
t.Fatalf("Can't parse URL. %v", err)
@@ -91,17 +84,10 @@ func TestFileSave(t *testing.T) {
9184

9285
// Save the config file to a new absolute path using a regular path
9386
p = tmpConfPath()
94-
<<<<<<< HEAD
9587
c.SetURL(p)
9688
u, err = ParseURL(p)
9789
if err != nil {
9890
t.Error("cannot parse url")
99-
=======
100-
c, err = New(p)
101-
if err != nil {
102-
t.Errorf("Error creating config file")
103-
104-
>>>>>>> moar test fixes
10591
}
10692
err = backend.Save(c)
10793
if err != nil {
@@ -114,7 +100,7 @@ func TestFileSave(t *testing.T) {
114100

115101
func Test_FileLoad_FileSave_YAML(t *testing.T) {
116102
// load
117-
u, err := url.Parse(filepath.Join("testdata", "beehive.yaml"))
103+
u, err := ParseURL(filepath.Join("testdata", "beehive.yaml"))
118104
if err != nil {
119105
t.Error("cannot parse config path")
120106
}
@@ -132,7 +118,7 @@ func Test_FileLoad_FileSave_YAML(t *testing.T) {
132118
t.Error("Could not create temp directory")
133119
}
134120
p := filepath.Join(tmpdir, "beehive.yaml")
135-
u, err = url.Parse("file://" + p)
121+
u, err = ParseURL("file://" + p)
136122
if err != nil {
137123
t.Error("cannot parse config path")
138124
}

0 commit comments

Comments
 (0)