github.com/uvalib/orcid-access-ws@v0.0.0-20250612130209-7d062dbabf9d/orcidaccessws/tests/get_all_attribs_test.go (about) 1 package test 2 3 import ( 4 "github.com/uvalib/orcid-access-ws/orcidaccessws/client" 5 "net/http" 6 "testing" 7 ) 8 9 // 10 // get all ORCID attributes tests 11 // 12 13 func TestGetAllOrcidAttributesHappyDay(t *testing.T) { 14 15 expected := http.StatusOK 16 status, attributes := client.GetAllOrcidAttributes(cfg.Endpoint, goodToken(cfg.Secret)) 17 if status != expected { 18 t.Fatalf("Expected %v, got %v\n", expected, status) 19 } 20 21 ensureValidOrcidsAttributes(t, attributes) 22 } 23 24 func TestGetAllOrcidAttributesEmptyToken(t *testing.T) { 25 expected := http.StatusBadRequest 26 status, _ := client.GetAllOrcidAttributes(cfg.Endpoint, empty) 27 if status != expected { 28 t.Fatalf("Expected %v, got %v\n", expected, status) 29 } 30 } 31 32 func TestGetAllOrcidAttributesBadToken(t *testing.T) { 33 expected := http.StatusForbidden 34 status, _ := client.GetAllOrcidAttributes(cfg.Endpoint, badToken(cfg.Secret)) 35 if status != expected { 36 t.Fatalf("Expected %v, got %v\n", expected, status) 37 } 38 } 39 40 // 41 // end of file 42 //