diff --git a/core/core_test.go b/core/core_test.go index 04e0f8d..688c8b6 100644 --- a/core/core_test.go +++ b/core/core_test.go @@ -16,8 +16,7 @@ import ( func TestCreate(t *testing.T) { createJson := []byte("{\"Name\":\"Alice\",\"Password\":\"Hello\"}") - os.Remove("/tmp/db1.json") - Init("/tmp/db1.json") + Init("memory") respJson, err := Create(createJson) if err != nil { @@ -45,14 +44,11 @@ func TestCreate(t *testing.T) { if s.Status == "ok" { t.Fatalf("Error in creating account when one exists, %v", s.Status) } - - os.Remove("/tmp/db1.json") } func TestSummary(t *testing.T) { createJson := []byte("{\"Name\":\"Alice\",\"Password\":\"Hello\"}") delegateJson := []byte("{\"Name\":\"Bob\",\"Password\":\"Rob\",\"Time\":\"2h\",\"Uses\":1}") - os.Remove("/tmp/db1.json") // check for summary of uninitialized vault respJson, err := Summary(createJson) @@ -68,7 +64,7 @@ func TestSummary(t *testing.T) { t.Fatalf("Error in summary of account with no vault, %v", s.Status) } - Init("/tmp/db1.json") + Init("memory") // check for summary of initialized vault respJson, err = Create(createJson) @@ -163,10 +159,6 @@ func TestSummary(t *testing.T) { if dataLive.Type != passvault.DefaultRecordType { t.Fatalf("Error in summary of account, record missing") } - - cache.FlushCache() - - os.Remove("/tmp/db1.json") } func TestPassword(t *testing.T) { @@ -175,9 +167,8 @@ func TestPassword(t *testing.T) { passwordJson := []byte("{\"Name\":\"Alice\",\"Password\":\"Hello\",\"NewPassword\":\"Olleh\"}") delegateJson2 := []byte("{\"Name\":\"Alice\",\"Password\":\"Olleh\",\"Time\":\"2h\",\"Uses\":1}") passwordJson2 := []byte("{\"Name\":\"Alice\",\"Password\":\"Olleh\",\"NewPassword\":\"Hello\"}") - os.Remove("/tmp/db1.json") - Init("/tmp/db1.json") + Init("memory") // check for summary of initialized vault with new member var s ResponseData @@ -276,10 +267,6 @@ func TestPassword(t *testing.T) { if s.Status != "ok" { t.Fatalf("Error in delegating account, %v", s.Status) } - - cache.FlushCache() - - os.Remove("/tmp/db1.json") } func TestEncryptDecrypt(t *testing.T) { @@ -291,9 +278,8 @@ func TestEncryptDecrypt(t *testing.T) { delegateJson5 := []byte("{\"Name\":\"Carol\",\"Password\":\"Hello\",\"Time\":\"10s\",\"Uses\":2,\"Users\":[\"Alice\"],\"Labels\":[\"blue\"]}") encryptJson := []byte("{\"Name\":\"Carol\",\"Password\":\"Hello\",\"Minumum\":2,\"Owners\":[\"Alice\",\"Bob\",\"Carol\"],\"Data\":\"SGVsbG8gSmVsbG8=\"}") encryptJson2 := []byte("{\"Name\":\"Alice\",\"Password\":\"Hello\",\"Minumum\":2,\"Owners\":[\"Alice\",\"Bob\",\"Carol\"],\"Data\":\"SGVsbG8gSmVsbG8=\",\"Labels\":[\"blue\",\"red\"]}") - os.Remove("/tmp/db1.json") - Init("/tmp/db1.json") + Init("memory") // check for summary of initialized vault with new member var s ResponseData @@ -465,10 +451,6 @@ func TestEncryptDecrypt(t *testing.T) { t.Fatalf("Error in decrypt, %v", d.Delegates) } } - - cache.FlushCache() - - os.Remove("/tmp/db1.json") } func TestModify(t *testing.T) { @@ -483,8 +465,7 @@ func TestModify(t *testing.T) { modifyJson4 := []byte("{\"Name\":\"Carol\",\"Password\":\"Hello\",\"ToModify\":\"Alice\",\"Command\":\"revoke\"}") modifyJson5 := []byte("{\"Name\":\"Carol\",\"Password\":\"Hello\",\"ToModify\":\"Alice\",\"Command\":\"delete\"}") - os.Remove("/tmp/db1.json") - Init("/tmp/db1.json") + Init("memory") // check for summary of initialized vault with new member var s ResponseData @@ -652,10 +633,6 @@ func TestModify(t *testing.T) { if len(sum3.All) != 2 { t.Fatalf("Error in summary, %v", sum3.All) } - - cache.FlushCache() - - os.Remove("/tmp/db1.json") } func TestStatic(t *testing.T) { diff --git a/index.html b/index.html index c3812be..1776365 100644 --- a/index.html +++ b/index.html @@ -385,10 +385,12 @@ data.Users = data.Users.split(','); for(var i=0, l=data.Users.length; i data.Users = data.Users.split(','); for(var i=0, l=data.Users.length; i data.Owners = data.Owners.split(','); for(var i=0, l=data.Owners.length; i