Skip to content

Commit

Permalink
fix tests Error -> Errorf
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulou committed Dec 23, 2014
1 parent ed5f165 commit c9937fc
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions config/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ func TestStoreAuth(t *testing.T) {
// First creation
err := StoreAuth(u)
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
clean()

// Rewrite over an existing file
err = StoreAuth(u)
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
err = StoreAuth(u)
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
clean()

// Add an additional api url
err = StoreAuth(u)
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
C.apiHost = "scalingo2.dev"
err = StoreAuth(u)
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
clean()
}
Expand All @@ -51,23 +51,23 @@ func TestLoadAuth(t *testing.T) {
// Load without Store should return nil User
u, err := LoadAuth()
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
if u != nil {
t.Error("%v should be nil", u)
t.Errorf("%v should be nil", u)
}

// Load after storage of credentials
err = StoreAuth(u)
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
uLoad, err := LoadAuth()
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
if !reflect.DeepEqual(uLoad, u) {
t.Error("want %v, got %v", u, uLoad)
t.Errorf("want %v, got %v", u, uLoad)
}

clean()
Expand All @@ -77,29 +77,29 @@ func TestExistingAuth(t *testing.T) {
// Before any auth
auth, err := existingAuth()
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
if len(auth.AuthConfigPerHost) > 0 {
t.Error("want auth.AuthConfigPerHost = [], got %v", auth.AuthConfigPerHost)
t.Errorf("want auth.AuthConfigPerHost = [], got %v", auth.AuthConfigPerHost)
}
if !auth.LastUpdate.IsZero() {
t.Error("auth should never have been updated: %v", auth.LastUpdate)
t.Errorf("auth should never have been updated: %v", auth.LastUpdate)
}

// After one auth
err = StoreAuth(u)
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
auth, err = existingAuth()
if err != nil {
t.Error("%v should be nil", err)
t.Errorf("%v should be nil", err)
}
if len(auth.AuthConfigPerHost) != 1 {
t.Error("want len(auth.AuthConfigPerHost) = 1, got %v", auth.AuthConfigPerHost)
t.Errorf("want len(auth.AuthConfigPerHost) = 1, got %v", auth.AuthConfigPerHost)
}
if auth.LastUpdate.IsZero() {
t.Error("auth should have been updated: %v", auth.LastUpdate)
t.Errorf("auth should have been updated: %v", auth.LastUpdate)
}

clean()
Expand Down

0 comments on commit c9937fc

Please sign in to comment.