File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ impl MockCookieUser {
344
344
345
345
MockTokenUser {
346
346
app : self . app . clone ( ) ,
347
- token,
347
+ token : Some ( token ) ,
348
348
plaintext : plaintext. expose_secret ( ) . into ( ) ,
349
349
}
350
350
}
@@ -353,7 +353,7 @@ impl MockCookieUser {
353
353
/// A type that can generate token authenticated requests
354
354
pub struct MockTokenUser {
355
355
app : TestApp ,
356
- token : ApiToken ,
356
+ token : Option < ApiToken > ,
357
357
plaintext : String ,
358
358
}
359
359
@@ -372,7 +372,8 @@ impl RequestHelper for MockTokenUser {
372
372
impl MockTokenUser {
373
373
/// Returns a reference to the database `ApiToken` model
374
374
pub fn as_model ( & self ) -> & ApiToken {
375
- & self . token
375
+ const ERROR : & str = "Original `ApiToken` was not set on this `MockTokenUser` instance" ;
376
+ self . token . as_ref ( ) . expect ( ERROR )
376
377
}
377
378
378
379
pub fn plaintext ( & self ) -> & str {
You can’t perform that action at this time.
0 commit comments