(t *testing.T)
| 211 | } |
| 212 | |
| 213 | func TestGetTokenBalance(t *testing.T) { |
| 214 | Convey("test get token balance", t, func() { |
| 215 | var stopTestService func() |
| 216 | var err error |
| 217 | // reset driver not initialized |
| 218 | atomic.StoreUint32(&driverInitialized, 0) |
| 219 | |
| 220 | // driver not initialized |
| 221 | _, err = GetTokenBalance(types.Particle) |
| 222 | So(err, ShouldEqual, ErrNotInitialized) |
| 223 | |
| 224 | // fake driver initialized |
| 225 | atomic.StoreUint32(&driverInitialized, 1) |
| 226 | _, err = GetTokenBalance(types.Particle) |
| 227 | So(err, ShouldNotBeNil) |
| 228 | // reset driver not initialized |
| 229 | atomic.StoreUint32(&driverInitialized, 0) |
| 230 | |
| 231 | stopTestService, _, err = startTestService() |
| 232 | So(err, ShouldBeNil) |
| 233 | defer stopTestService() |
| 234 | |
| 235 | var balance uint64 |
| 236 | balance, err = GetTokenBalance(types.Particle) |
| 237 | |
| 238 | So(err, ShouldBeNil) |
| 239 | So(balance, ShouldEqual, 0) |
| 240 | |
| 241 | balance, err = GetTokenBalance(-1) |
| 242 | |
| 243 | So(err, ShouldEqual, ErrNoSuchTokenBalance) |
| 244 | }) |
| 245 | } |
| 246 | |
| 247 | func TestWaitDBCreation(t *testing.T) { |
| 248 | Convey("test WaitDBCreation", t, func() { |
nothing calls this directly
no test coverage detected