diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-08-26 13:31:18 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-10-28 17:02:14 +0100 |
| commit | f875f7138978fea56c888e2ea9d88ea46c8fbc28 (patch) | |
| tree | ca551598e4506dc5fdacc0e56bd081ffff907426 /exports/exports_wrapper.go | |
| parent | 4b07ddd03c1a0323a538206fd8aaa10a361ec224 (diff) | |
Exports: Add tests for cleanup and profile id
Diffstat (limited to 'exports/exports_wrapper.go')
| -rw-r--r-- | exports/exports_wrapper.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/exports/exports_wrapper.go b/exports/exports_wrapper.go index 1dd0675..0e25232 100644 --- a/exports/exports_wrapper.go +++ b/exports/exports_wrapper.go @@ -173,6 +173,10 @@ func testServer(t *testing.T) *test.Server { }`, }, { + Method: http.MethodPost, + Path: "/test-api-endpoint/disconnect", + }, + { Path: "/test-api-endpoint/connect", ResponseHandler: func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { @@ -265,6 +269,30 @@ func testServerList(t *testing.T) { } } +func testSetProfileID(t *testing.T) { + prfS := C.CString("idontexist") + defer FreeString(prfS) + pErr := getError(t, SetProfileID(prfS)) + if pErr == "" { + t.Fatal("got empty error for non-existent profile") + } + prfS2 := C.CString("employees") + defer FreeString(prfS2) + pErr = getError(t, SetProfileID(prfS2)) + if pErr != "" { + t.Fatal("got error setting existent profile") + } +} + +func testCleanup(t *testing.T) { + ck := CookieNew() + defer CookieDelete(ck) + cErr := getError(t, Cleanup(ck)) + if cErr != "" { + t.Fatalf("failed cleaning up connection: %v", cErr) + } +} + func testGetConfig(t *testing.T) { mustRegister(t) defer Deregister() @@ -318,4 +346,7 @@ func testGetConfig(t *testing.T) { if !ok { t.Fatalf("VPN config does not match regex: %v", cfgS) } + + testSetProfileID(t) + testCleanup(t) } |
