summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-03-20 17:12:36 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2023-09-25 09:43:37 +0200
commit1f599f1aab37343ff61852a8616c640310dfaee4 (patch)
treef9784b2dc5c73ceab9fbc8cf6cdaab922385c553 /internal
parentcd4f13c5a8df0d7da2fbca3a741d396f220cff33 (diff)
Tests: Pass for V2 API
Diffstat (limited to 'internal')
-rw-r--r--internal/discovery/discovery_test.go34
-rw-r--r--internal/verify/verify_test.go8
2 files changed, 21 insertions, 21 deletions
diff --git a/internal/discovery/discovery_test.go b/internal/discovery/discovery_test.go
index 2e6c38f..93ab51e 100644
--- a/internal/discovery/discovery_test.go
+++ b/internal/discovery/discovery_test.go
@@ -7,7 +7,7 @@ import (
"time"
"github.com/eduvpn/eduvpn-common/internal/test"
- "github.com/eduvpn/eduvpn-common/types"
+ discotypes "github.com/eduvpn/eduvpn-common/types/discovery"
)
// TestServers tests whether or not we can obtain discovery servers
@@ -85,9 +85,9 @@ func TestOrganizations(t *testing.T) {
// TestSecureLocationList tests the function for getting a list of secure internet servers
func TestSecureLocationList(t *testing.T) {
d := Discovery{
- ServerList: types.DiscoveryServers{
+ ServerList: discotypes.Servers{
Version: 1,
- List: []types.DiscoveryServer{
+ List: []discotypes.Server{
// institute access server, this should not be found
{CountryCode: "", Type: "institute_access"},
// secure internet servers, these should be found
@@ -110,9 +110,9 @@ func TestSecureLocationList(t *testing.T) {
// TestServerByURL tests the function for getting a server by the Base URL and type
func TestServerByURL(t *testing.T) {
d := Discovery{
- ServerList: types.DiscoveryServers{
+ ServerList: discotypes.Servers{
Version: 1,
- List: []types.DiscoveryServer{
+ List: []discotypes.Server{
// institute access server
{BaseURL: "a", Type: "institute_access"},
// secure internet servers
@@ -149,11 +149,11 @@ func TestServerByURL(t *testing.T) {
// TestServerByCountryCode tests the function for getting a server by the country code
func TestServerByCountryCode(t *testing.T) {
- s1 := types.DiscoveryServer{CountryCode: "a", Type: "secure_internet"}
+ s1 := discotypes.Server{CountryCode: "a", Type: "secure_internet"}
d := Discovery{
- ServerList: types.DiscoveryServers{
+ ServerList: discotypes.Servers{
Version: 1,
- List: []types.DiscoveryServer{
+ List: []discotypes.Server{
// secure internet server
s1,
// Unexpected types, these should not be found
@@ -184,11 +184,11 @@ func TestServerByCountryCode(t *testing.T) {
// TestOrgByID tests the function for getting an organization by ID
func TestOrgByID(t *testing.T) {
- o1 := types.DiscoveryOrganization{OrgID: "a"}
+ o1 := discotypes.Organization{OrgID: "a"}
d := Discovery{
- OrganizationList: types.DiscoveryOrganizations{
+ OrganizationList: discotypes.Organizations{
Version: 1,
- List: []types.DiscoveryOrganization{
+ List: []discotypes.Organization{
o1,
},
},
@@ -208,19 +208,19 @@ func TestOrgByID(t *testing.T) {
// TestSecureHomeArgs tests the function for getting an organization and matching secure internet server by organization ID
func TestSecureHomeArgs(t *testing.T) {
- o1 := types.DiscoveryOrganization{OrgID: "id", SecureInternetHome: "a"}
- s1 := types.DiscoveryServer{BaseURL: "a", Type: "secure_internet"}
+ o1 := discotypes.Organization{OrgID: "id", SecureInternetHome: "a"}
+ s1 := discotypes.Server{BaseURL: "a", Type: "secure_internet"}
d := Discovery{
- OrganizationList: types.DiscoveryOrganizations{
+ OrganizationList: discotypes.Organizations{
Version: 1,
- List: []types.DiscoveryOrganization{
+ List: []discotypes.Organization{
{OrgID: "id2", SecureInternetHome: "c"},
o1,
},
},
- ServerList: types.DiscoveryServers{
+ ServerList: discotypes.Servers{
Version: 1,
- List: []types.DiscoveryServer{
+ List: []discotypes.Server{
s1,
{BaseURL: "b"},
},
diff --git a/internal/verify/verify_test.go b/internal/verify/verify_test.go
index cbc6cb9..bb270a4 100644
--- a/internal/verify/verify_test.go
+++ b/internal/verify/verify_test.go
@@ -359,24 +359,24 @@ func compareResults(
t.Errorf("error not expected but returned '%s', callstr '%s'", err.Error(), callStr())
}
if !ret {
- t.Errorf("error is nil and result is false, callstr '%s'", callStr())
+ t.Errorf("error is nil and result is false, callstr: '%s'", callStr())
}
return
}
if err == nil {
// we expect an error but received nil
- t.Errorf("expected error prefix '%s' but received nil, callstr '%s'", expectedErrPrefix, callStr())
+ t.Errorf("expected error prefix '%s' but received nil, callstr: '%s'", expectedErrPrefix, callStr())
return
}
if !strings.HasPrefix(err.Error(), expectedErrPrefix) {
// wrong error
- t.Errorf("expected error prefix '%s' for error '%s', callStr '%s'", expectedErrPrefix, err.Error(), callStr())
+ t.Errorf("expected error prefix '%s' for error '%s', callstr '%s'", expectedErrPrefix, err.Error(), callStr())
return
}
if ret {
- t.Errorf("error is not nil and result is true, callStr '%s'", callStr())
+ t.Errorf("error is not nil and result is true, '%s'", callStr())
}
}