@@ -15,19 +15,19 @@ func TestDefaultValues(t *testing.T) {
1515 c .home = "/home/alice"
1616 c .configure ()
1717 assert .Equal (t , "" , c .APIKey )
18- assert .Equal (t , "http://exercism.io" , c .Hostname )
18+ assert .Equal (t , "http://exercism.io" , c .API )
1919 assert .Equal (t , "/home/alice/exercism" , c .Dir )
2020}
2121
2222func TestCustomValues (t * testing.T ) {
2323 c := & Config {
24- APIKey : "abc123" ,
25- Hostname : "http://example.org" ,
26- Dir : "/path/to/exercises" ,
24+ APIKey : "abc123" ,
25+ API : "http://example.org" ,
26+ Dir : "/path/to/exercises" ,
2727 }
2828 c .configure ()
2929 assert .Equal (t , "abc123" , c .APIKey )
30- assert .Equal (t , "http://example.org" , c .Hostname )
30+ assert .Equal (t , "http://example.org" , c .API )
3131 assert .Equal (t , "/path/to/exercises" , c .Dir )
3232}
3333
@@ -40,13 +40,13 @@ func TestExpandHomeDir(t *testing.T) {
4040
4141func TestSanitizeWhitespace (t * testing.T ) {
4242 c := & Config {
43- APIKey : " abc123\n \r \n " ,
44- Hostname : " " ,
45- Dir : " \r \n /path/to/exercises \r \n " ,
43+ APIKey : " abc123\n \r \n " ,
44+ API : " " ,
45+ Dir : " \r \n /path/to/exercises \r \n " ,
4646 }
4747 c .configure ()
4848 assert .Equal (t , "abc123" , c .APIKey )
49- assert .Equal (t , "http://exercism.io" , c .Hostname )
49+ assert .Equal (t , "http://exercism.io" , c .API )
5050 assert .Equal (t , "/path/to/exercises" , c .Dir )
5151}
5252
@@ -68,7 +68,7 @@ func TestReadNonexistantConfig(t *testing.T) {
6868 c , err := Read ("/no/such/config.json" )
6969 assert .NoError (t , err )
7070 assert .Equal (t , c .APIKey , "" )
71- assert .Equal (t , c .Hostname , "http://exercism.io" )
71+ assert .Equal (t , c .API , "http://exercism.io" )
7272 assert .False (t , c .IsAuthenticated ())
7373 if ! strings .HasSuffix (c .Dir , "/exercism" ) {
7474 t .Fatal ("Default unconfigured config should use home dir" )
@@ -81,10 +81,11 @@ func TestReadingWritingConfig(t *testing.T) {
8181 assert .NoError (t , err )
8282
8383 c1 := & Config {
84- APIKey : "MyKey" ,
85- Dir : "/exercism/directory" ,
86- Hostname : "localhost" ,
84+ APIKey : "MyKey" ,
85+ Dir : "/exercism/directory" ,
86+ API : "localhost" ,
8787 }
88+ c1 .configure ()
8889
8990 c1 .SavePath (filename )
9091 c1 .Write ()
@@ -94,7 +95,7 @@ func TestReadingWritingConfig(t *testing.T) {
9495
9596 assert .Equal (t , c1 .APIKey , c2 .APIKey )
9697 assert .Equal (t , c1 .Dir , c2 .Dir )
97- assert .Equal (t , c1 .Hostname , c2 .Hostname )
98+ assert .Equal (t , c1 .API , c2 .API )
9899}
99100
100101func TestReadDefaultConfig (t * testing.T ) {
@@ -106,7 +107,7 @@ func TestReadDefaultConfig(t *testing.T) {
106107 assert .NoError (t , err )
107108 assert .Equal (t , "abc123" , c .APIKey )
108109 assert .Equal (t , "/path/to/exercism" , c .Dir )
109- assert .Equal (t , "http://example.com" , c .Hostname )
110+ assert .Equal (t , "http://example.com" , c .API )
110111 assert .Equal (t , "http://x.example.com" , c .ProblemsHost )
111112}
112113
@@ -120,7 +121,7 @@ func TestReadCustomConfig(t *testing.T) {
120121 assert .NoError (t , err )
121122 assert .Equal (t , "xyz000" , c .APIKey )
122123 assert .Equal (t , "/tmp/exercism" , c .Dir )
123- assert .Equal (t , "http://example.org" , c .Hostname )
124+ assert .Equal (t , "http://example.org" , c .API )
124125 assert .Equal (t , "http://x.example.org" , c .ProblemsHost )
125126}
126127
@@ -134,6 +135,6 @@ func TestReadLegacyConfig(t *testing.T) {
134135 assert .NoError (t , err )
135136 assert .Equal (t , "prq567" , c .APIKey )
136137 assert .Equal (t , "/tmp/stuff" , c .Dir )
137- assert .Equal (t , "http://api.example.com" , c .Hostname )
138+ assert .Equal (t , "http://api.example.com" , c .API )
138139 assert .Equal (t , "http://problems.example.com" , c .ProblemsHost )
139140}
0 commit comments