Browse Source

Fixed merge conflict

Adam Pritchard 11 years ago
parent
commit
36c5a061c8
2 changed files with 19 additions and 5 deletions
  1. 17 1
      psiphon/config_test.go
  2. 2 4
      psiphonTunnelCore_test.go

+ 17 - 1
psiphon/config_test.go

@@ -37,7 +37,7 @@ import (
 )
 )
 
 
 const (
 const (
-	_TEST_DIR = "testfiles"
+	_TEST_DIR = "./testfiles"
 )
 )
 
 
 type ConfigTestSuite struct {
 type ConfigTestSuite struct {
@@ -68,6 +68,22 @@ func (suite *ConfigTestSuite) Test_LoadConfig_BadPath() {
 	suite.NotNil(err, "error should be set")
 	suite.NotNil(err, "error should be set")
 }
 }
 
 
+// Tests good config file path
+func (suite *ConfigTestSuite) Test_LoadConfig_GoodPath() {
+	filename := filepath.Join(_TEST_DIR, "good.json")
+	writeConfigFile(filename, `{"PropagationChannelId": "xyz", "SponsorId": "xyz", "RemoteServerListUrl": "xyz", "RemoteServerListSignaturePublicKey": "xyz"}`)
+
+	// Use absolute path
+	abspath, _ := filepath.Abs(filename)
+	_, err := LoadConfig(abspath)
+	suite.Nil(err, "error should not be set")
+
+	// Use relative path
+	suite.False(filepath.IsAbs(filename))
+	_, err = LoadConfig(filename)
+	suite.Nil(err, "error should not be set")
+}
+
 // Tests non-JSON file contents
 // Tests non-JSON file contents
 func (suite *ConfigTestSuite) Test_LoadConfig_BadFileContents() {
 func (suite *ConfigTestSuite) Test_LoadConfig_BadFileContents() {
 	filename := filepath.Join(_TEST_DIR, "junk.json")
 	filename := filepath.Join(_TEST_DIR, "junk.json")

+ 2 - 4
psiphonTunnelCore_test.go

@@ -20,11 +20,9 @@
 package main
 package main
 
 
 import (
 import (
-	"psiphon"
+	//"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon"
+	"testing"
 )
 )
 
 
 func TestPsiphon(t *testing.T) {
 func TestPsiphon(t *testing.T) {
-	var config psiphon.Config
-	// TODO: put a test config here
-	psiphon.RunTunnelForever(&config)
 }
 }