This repository has been archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Originally, the `duffle key add` allowed only ASCII armored keys. But the more common format is binary keys. So this makes binary keys the default, but provides the --armored/-a flag for loading ASCII keys
- Loading branch information
1 parent
d1f641d
commit c347196
Showing
5 changed files
with
38 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,13 +69,13 @@ func TestKeyring_KeyByID(t *testing.T) { | |
is.Equal(key.entity.Identities[key2Email].Name, key2Email) | ||
} | ||
|
||
func TestKeyRing_Add(t *testing.T) { | ||
func TestKeyRing_Add_Armored(t *testing.T) { | ||
is := assert.New(t) | ||
extras, err := os.Open("testdata/extra.gpg") | ||
is.NoError(err) | ||
kr, err := LoadKeyRing(keyringFile) | ||
is.NoError(err) | ||
is.NoError(kr.Add(extras)) | ||
is.NoError(kr.Add(extras, true)) | ||
|
||
k, err := kr.Key("[email protected]") | ||
is.NoError(err) | ||
|
@@ -89,13 +89,27 @@ func TestKeyRing_Add(t *testing.T) { | |
is.NoError(err) | ||
|
||
// Re-add extras | ||
is.NoError(kr.Add(extras)) | ||
is.NoError(kr.Add(extras, true)) | ||
k2, err := kr.Key("[email protected]") | ||
is.NoError(err) | ||
is.Equal(k2.entity.Identities[fullExtraID].Name, fullExtraID) | ||
is.Equal(l, kr.Len()) | ||
} | ||
|
||
func TestKeyRing_Add_NotArmored(t *testing.T) { | ||
is := assert.New(t) | ||
extras, err := os.Open("testdata/extra1-public.key") | ||
is.NoError(err) | ||
kr, err := LoadKeyRing(keyringFile) | ||
is.NoError(err) | ||
is.NoError(kr.Add(extras, false)) | ||
|
||
k, err := kr.Key("[email protected]") | ||
is.NoError(err) | ||
is.Equal(k.entity.Identities[fullExtraID].Name, fullExtraID) | ||
|
||
} | ||
|
||
func TestKeyRing_AddKey(t *testing.T) { | ||
is := assert.New(t) | ||
|
||
|
@@ -125,7 +139,7 @@ func TestCreateKeyRing(t *testing.T) { | |
is.NoError(err) | ||
|
||
kr := CreateKeyRing(testPassphraseFetch) | ||
is.NoError(kr.Add(extras)) | ||
is.NoError(kr.Add(extras, true)) | ||
|
||
k, err := kr.Key("[email protected]") | ||
is.NoError(err) | ||
|
Binary file not shown.