package main import ( "strings" "testing" "hamlog/internal/extsvc" ) // An upload to a service with no credentials used to look exactly like one that // worked: it ran on its own goroutine and reported into the QSL Manager's // console, which is not open when the command came from the QSO list. func TestUploadRefusesAnUnconfiguredService(t *testing.T) { var empty extsvc.ExternalServices for _, svc := range []extsvc.Service{ extsvc.ServiceCloudlog, extsvc.ServiceQRZ, extsvc.ServiceClublog, extsvc.ServiceHRDLog, extsvc.ServiceEQSL, extsvc.ServiceHamQTH, extsvc.ServiceLoTW, } { err := uploadConfigured(svc, empty) if err == nil { t.Errorf("%s: an unconfigured service was accepted", svc) continue } if !strings.Contains(err.Error(), "Settings") { t.Errorf("%s: %q does not say where to fix it", svc, err) } } // Configured: nothing in the way. cfg := extsvc.ExternalServices{} cfg.Cloudlog.URL, cfg.Cloudlog.APIKey = "https://log.f4bpo.fr", "cl123" if err := uploadConfigured(extsvc.ServiceCloudlog, cfg); err != nil { t.Errorf("a configured Cloudlog was refused: %v", err) } }