1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

cleaned up some of the osx code, added a better test for list

Signed-off-by: avaid96 <avaid1996@gmail.com>
This commit is contained in:
avaid96
2016-07-11 23:34:20 -07:00
parent 7566a1e399
commit 205e3b3056
5 changed files with 24 additions and 16 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ char *keychain_list(char *** paths, char *** accts, unsigned int *list_l) {
char * path = (char *) malloc(CFStringGetLength(pathTmp)+1);
path = CFStringToCharArr(pathTmp);
path[strlen(path)] = '\0';
char * acct = (char *) malloc(CFStringGetLength(acctTmp)+1); //<- problem line in 38th iteration
char * acct = (char *) malloc(CFStringGetLength(acctTmp)+1);
acct = CFStringToCharArr(acctTmp);
acct[strlen(acct)] = '\0';
//We now have all we need, username and servername. Now export this to .go
+9 -3
View File
@@ -1,8 +1,8 @@
package osxkeychain
import (
"testing"
"github.com/docker/docker-credential-helpers/credentials"
"testing"
)
func TestOSXKeychainHelper(t *testing.T) {
@@ -34,10 +34,16 @@ func TestOSXKeychainHelper(t *testing.T) {
t.Fatal(err)
}
_, _, err = helper.List();
if err != nil {
paths, accts, err := helper.List()
if err != nil || len(paths) == 0 || len(accts) == 0 {
t.Fatal(err)
}
helper.Add(creds)
newpaths, newaccts, err := helper.List()
if len(newpaths)-len(paths) != 1 || len(newaccts)-len(accts) != 1 {
t.Fatal()
}
helper.Delete(creds.ServerURL)
}
func TestMissingCredentials(t *testing.T) {