Skip to content

Commit 33cd3c0

Browse files
author
Katrina Owen
committed
Ensure user config is complete in submit tests
The submit command tests would fail spuriously if we validate that the api url is set (i.e. that the CLI is configured).
1 parent 05096a3 commit 33cd3c0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/submit_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func TestSubmitNonExistentFile(t *testing.T) {
5454
v := viper.New()
5555
v.Set("token", "abc123")
5656
v.Set("workspace", tmpDir)
57+
v.Set("apibaseurl", "http://api.example.com")
5758

5859
cfg := config.Config{
5960
Persister: config.InMemoryPersister{},
@@ -92,6 +93,7 @@ func TestSubmitExerciseWithoutMetadataFile(t *testing.T) {
9293
v := viper.New()
9394
v.Set("token", "abc123")
9495
v.Set("workspace", tmpDir)
96+
v.Set("apibaseurl", "http://api.example.com")
9597

9698
cfg := config.Config{
9799
Persister: config.InMemoryPersister{},
@@ -113,6 +115,7 @@ func TestSubmitFilesAndDir(t *testing.T) {
113115
v := viper.New()
114116
v.Set("token", "abc123")
115117
v.Set("workspace", tmpDir)
118+
v.Set("apibaseurl", "http://api.example.com")
116119

117120
cfg := config.Config{
118121
Persister: config.InMemoryPersister{},
@@ -426,6 +429,7 @@ func TestSubmitOnlyEmptyFile(t *testing.T) {
426429
v := viper.New()
427430
v.Set("token", "abc123")
428431
v.Set("workspace", tmpDir)
432+
v.Set("apibaseurl", "http://api.example.com")
429433

430434
cfg := config.Config{
431435
Persister: config.InMemoryPersister{},
@@ -465,6 +469,7 @@ func TestSubmitFilesFromDifferentSolutions(t *testing.T) {
465469
v := viper.New()
466470
v.Set("token", "abc123")
467471
v.Set("workspace", tmpDir)
472+
v.Set("apibaseurl", "http://api.example.com")
468473

469474
cfg := config.Config{
470475
Persister: config.InMemoryPersister{},

0 commit comments

Comments
 (0)