1
1
package cfg
2
2
3
3
import (
4
- << << << < HEAD
5
4
"io/ioutil"
6
- "net/url"
7
- == == == =
8
- >> >> >> > :lipstick:
9
5
"os"
10
6
"path/filepath"
11
7
"testing"
@@ -23,11 +19,7 @@ func TestFileLoad(t *testing.T) {
23
19
// try to load the config from a relative path
24
20
u , err = ParseURL (filepath .Join ("testdata" , "beehive.conf" ))
25
21
if err != nil {
26
- << << << < HEAD
27
- t .Error ("cannot parse config path" )
28
- == == == =
29
22
t .Fatalf ("Can't parse URL. %v" , err )
30
- >> >> >> > Test fixes
31
23
}
32
24
backend = NewFileBackend ()
33
25
conf , err := backend .Load (u )
@@ -56,6 +48,7 @@ func TestFileLoad(t *testing.T) {
56
48
}
57
49
58
50
func TestFileSave (t * testing.T ) {
51
+ tmpdir , err := ioutil .TempDir ("" , "beehivetest" )
59
52
u , err := ParseURL (filepath .Join ("testdata" , "beehive.conf" ))
60
53
if err != nil {
61
54
t .Fatalf ("Can't parse URL. %v" , err )
@@ -91,17 +84,10 @@ func TestFileSave(t *testing.T) {
91
84
92
85
// Save the config file to a new absolute path using a regular path
93
86
p = tmpConfPath ()
94
- << << << < HEAD
95
87
c .SetURL (p )
96
88
u , err = ParseURL (p )
97
89
if err != nil {
98
90
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
105
91
}
106
92
err = backend .Save (c )
107
93
if err != nil {
@@ -114,7 +100,7 @@ func TestFileSave(t *testing.T) {
114
100
115
101
func Test_FileLoad_FileSave_YAML (t * testing.T ) {
116
102
// load
117
- u , err := url . Parse (filepath .Join ("testdata" , "beehive.yaml" ))
103
+ u , err := ParseURL (filepath .Join ("testdata" , "beehive.yaml" ))
118
104
if err != nil {
119
105
t .Error ("cannot parse config path" )
120
106
}
@@ -132,7 +118,7 @@ func Test_FileLoad_FileSave_YAML(t *testing.T) {
132
118
t .Error ("Could not create temp directory" )
133
119
}
134
120
p := filepath .Join (tmpdir , "beehive.yaml" )
135
- u , err = url . Parse ("file://" + p )
121
+ u , err = ParseURL ("file://" + p )
136
122
if err != nil {
137
123
t .Error ("cannot parse config path" )
138
124
}
0 commit comments