Aucune description

account_test.go 1.1KB

    package main import ( "os" "testing" ) func TestGetAccounts(t *testing.T) { a, err := getAccounts() if err != nil || a == nil { t.Error(err) } } func TestCreate(t *testing.T) { a := Account{ Username: "guest", Passphrase: "guest", } ConfigureEnvironment() err := a.Create() if err != nil { t.Error(err) } valid, err := a.Validate() if err != nil { t.Error(err) } if !valid { t.Error("Failed to create account") } } func TestValidate(t *testing.T) { a := Account{ Username: "fake", Passphrase: "fake", } valid, err := a.Validate() if err != nil { t.Error(err) } if valid { t.Error("Fake account should not exist") } } func TestAdd(t *testing.T) { } func TestPublish(t *testing.T) { } func TestDelete(t *testing.T) { a := Account{ Username: "guest", Passphrase: "guest", } ConfigureEnvironment() err := a.Delete() if err != nil { t.Error(err) } valid, err := a.Validate() if err != nil { t.Error(err) } if valid { t.Error("Failed to delete account") } } func TestCleanup(t *testing.T) { err := os.Remove("loop_users") if err != nil { t.Error(err) } }