(t *testing.T)
| 130 | } |
| 131 | |
| 132 | func TestCleanup(t *testing.T) { |
| 133 | token := "token" |
| 134 | |
| 135 | client := newTestClient() |
| 136 | client.regTokens = map[string]*github.RegistrationToken{ |
| 137 | "active": &github.RegistrationToken{ |
| 138 | Token: &token, |
| 139 | ExpiresAt: &github.Timestamp{Time: time.Now().Add(time.Hour * 1)}, |
| 140 | }, |
| 141 | "expired": &github.RegistrationToken{ |
| 142 | Token: &token, |
| 143 | ExpiresAt: &github.Timestamp{Time: time.Now().Add(-time.Hour * 1)}, |
| 144 | }, |
| 145 | } |
| 146 | |
| 147 | client.cleanup() |
| 148 | if _, ok := client.regTokens["active"]; !ok { |
| 149 | t.Errorf("active token was accidentally removed") |
| 150 | } |
| 151 | if _, ok := client.regTokens["expired"]; ok { |
| 152 | t.Errorf("expired token still exists") |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | func TestUserAgent(t *testing.T) { |
| 157 | client := newTestClient() |
nothing calls this directly
no test coverage detected