-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #939 from wakatime/develop
Release v1.84.0
- Loading branch information
Showing
388 changed files
with
4,806 additions
and
5,154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//go:build ip | ||
|
||
package main_test | ||
|
||
import ( | ||
"encoding/json" | ||
"io" | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/wakatime/wakatime-cli/pkg/api" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
type ( | ||
Meta struct { | ||
Data MetaData `json:"data"` | ||
} | ||
|
||
MetaData struct { | ||
Ips MetaDataIps `json:"ips"` | ||
} | ||
|
||
MetaDataIps struct { | ||
Api MetaDataIpsApi `json:"api"` | ||
} | ||
|
||
MetaDataIpsApi struct { | ||
V4 []string `json:"v4"` | ||
V6 []string `json:"v6"` | ||
} | ||
) | ||
|
||
func TestHardCodedIPs(t *testing.T) { | ||
resp, err := http.Get("https://wakatime.com/api/v1/meta") | ||
require.NoError(t, err) | ||
|
||
body, err := io.ReadAll(resp.Body) | ||
require.NoError(t, err) | ||
|
||
var meta Meta | ||
|
||
err = json.Unmarshal(body, &meta) | ||
require.NoError(t, err) | ||
|
||
assert.Contains(t, meta.Data.Ips.Api.V4, api.BaseIPAddrv4) | ||
assert.Contains(t, meta.Data.Ips.Api.V6, api.BaseIPAddrv6) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.