summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-05-22 14:32:38 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-05-29 14:36:10 +0200
commitef7f44e4bb7713b18e6c0ab1b6e3510075b6623b (patch)
treeb44d871f0bc6b128fcda037c43318f20424ee891 /internal
parentc5c8bcfc53dd4d80133b39c3b130c6600e9cec99 (diff)
Discovery: return country_code to the client
Diffstat (limited to 'internal')
-rw-r--r--internal/discovery/discovery.go2
-rw-r--r--internal/discovery/discovery_test.go14
2 files changed, 7 insertions, 9 deletions
diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go
index fee4e9c..783febf 100644
--- a/internal/discovery/discovery.go
+++ b/internal/discovery/discovery.go
@@ -73,8 +73,6 @@ type Server struct {
discotypes.Server
// AuthenticationURLTemplate is the template to be used for authentication to skip WAYF
AuthenticationURLTemplate string `json:"authentication_url_template,omitempty"`
- // CountryCode is the country code for the server in case of secure internet, e.g. NL
- CountryCode string `json:"country_code,omitempty"`
// KeywordList are the keywords of the server, omitted if empty
KeywordList discotypes.MapOrString `json:"keyword_list,omitempty"`
// PublicKeyList are the public keys of the server. Currently not used in this lib but returned by the upstream discovery server
diff --git a/internal/discovery/discovery_test.go b/internal/discovery/discovery_test.go
index c2bbf44..03ea109 100644
--- a/internal/discovery/discovery_test.go
+++ b/internal/discovery/discovery_test.go
@@ -90,12 +90,12 @@ func TestSecureLocationList(t *testing.T) {
Version: 1,
List: []Server{
// institute access server, this should not be found
- {Server: discotypes.Server{Type: "institute_access"}, CountryCode: ""},
+ {Server: discotypes.Server{Type: "institute_access"}},
// secure internet servers, these should be found
- {Server: discotypes.Server{Type: "secure_internet"}, CountryCode: "b"},
- {Server: discotypes.Server{Type: "secure_internet"}, CountryCode: "c"},
+ {Server: discotypes.Server{Type: "secure_internet", CountryCode: "b"}},
+ {Server: discotypes.Server{Type: "secure_internet", CountryCode: "c"}},
// Unexpected type, this should not be found
- {Server: discotypes.Server{Type: "test"}, CountryCode: "d"},
+ {Server: discotypes.Server{Type: "test", CountryCode: "d"}},
},
},
}
@@ -150,7 +150,7 @@ func TestServerByURL(t *testing.T) {
// TestServerByCountryCode tests the function for getting a server by the country code
func TestServerByCountryCode(t *testing.T) {
- s1 := Server{Server: discotypes.Server{Type: "secure_internet"}, CountryCode: "a"}
+ s1 := Server{Server: discotypes.Server{Type: "secure_internet", CountryCode: "a"}}
d := Discovery{
ServerList: Servers{
Version: 1,
@@ -158,8 +158,8 @@ func TestServerByCountryCode(t *testing.T) {
// secure internet server
s1,
// Unexpected types, these should not be found
- {Server: discotypes.Server{Type: "institute_access"}, CountryCode: "b"},
- {Server: discotypes.Server{Type: "test"}, CountryCode: "c"},
+ {Server: discotypes.Server{Type: "institute_access", CountryCode: "b"}},
+ {Server: discotypes.Server{Type: "test", CountryCode: "c"}},
},
},
}