Browse Source

Added coverage for missing SponsorId field in config

Miro Kuratczyk 10 years ago
parent
commit
ad918a0fed
1 changed files with 7 additions and 0 deletions
  1. 7 0
      psiphon/config_test.go

+ 7 - 0
psiphon/config_test.go

@@ -93,6 +93,13 @@ func (suite *ConfigTestSuite) Test_LoadConfig_BadJson() {
 	_, err = LoadConfig(testObjJSON)
 	suite.NotNil(err, "JSON with one of our required fields missing should fail")
 
+	// Missing required SponsorId field
+	json.Unmarshal(suite.confStubBlob, &testObj)
+	delete(testObj, suite.requiredFields[1]) // will need to update if config in README changes
+	testObjJSON, _ = json.Marshal(testObj)
+	_, err = LoadConfig(testObjJSON)
+	suite.NotNil(err, "JSON with missing SponsorId field should fail")
+
 	// Bad type for required field
 	json.Unmarshal(suite.confStubBlob, &testObj)
 	testObj[suite.requiredFields[0]] = false // basically guessing a wrong type