-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consensus/metadata: fetch logo URL from keybase
- Loading branch information
Showing
11 changed files
with
529 additions
and
391 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Validator media updates | ||
|
||
Adds `LogoUrl` field to the `ValidatorMedia` type. | ||
Also updates `ValidatorMedia` fields to match `RegistryMetadata`: | ||
|
||
- `website_link` -> `url` | ||
- `email_address` -> `email` | ||
- `twitter_acc` -> `twitter` | ||
- `tg_chat` removed | ||
- `keybase` added |
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,51 @@ | ||
package metadata_registry | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParseKeybaseResponse(t *testing.T) { | ||
tc := []struct { | ||
json string | ||
shouldErr bool | ||
resp string | ||
}{ | ||
// https://keybase.io/_/api/1.0/user/lookup.json?fields=pictures&usernames=ptrs | ||
{ | ||
json: `{"status":{"code":0,"name":"OK"},"them":[{"id":"149815106745ab70d3e9cdc00fc96419","pictures":{"primary":{"url":"https://s3.amazonaws.com/keybase_processed_uploads/ef2c20c2c1e1a6584d91c49303fd8e05_360_360.jpg","source":null}}},{"id":"a19ba1453ec120ed157c6e85b245c119"}]}`, | ||
shouldErr: false, | ||
resp: "https://s3.amazonaws.com/keybase_processed_uploads/ef2c20c2c1e1a6584d91c49303fd8e05_360_360.jpg", | ||
}, | ||
// https://keybase.io/_/api/1.0/user/lookup.json?fields=pictures&usernames=test | ||
{ | ||
json: `{"status":{"code":0,"name":"OK"},"them":[{"id":"a19ba1453ec120ed157c6e85b245c119"}]}`, | ||
shouldErr: false, | ||
resp: "", | ||
}, | ||
// Invalid JSON. | ||
{ | ||
json: `{"status":123, "code}`, | ||
shouldErr: true, | ||
resp: "", | ||
}, | ||
// Empty response. | ||
{ | ||
json: "", | ||
shouldErr: true, | ||
resp: "", | ||
}, | ||
} | ||
|
||
for _, tt := range tc { | ||
url, err := parseKeybaseLogoUrl(strings.NewReader(tt.json)) | ||
if tt.shouldErr { | ||
require.Error(t, err) | ||
} else { | ||
require.NoError(t, err) | ||
require.Equal(t, tt.resp, url) | ||
} | ||
} | ||
} |
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,6 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE chain.entities | ||
ADD COLUMN logo_url TEXT; | ||
|
||
COMMIT; |
Oops, something went wrong.