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 @@ -335,7 +335,7 @@ impl MockCookieUser {
335
335
336
336
MockTokenUser {
337
337
app : self . app . clone ( ) ,
338
- token,
338
+ token : Some ( token ) ,
339
339
plaintext : plaintext. expose_secret ( ) . into ( ) ,
340
340
}
341
341
}
@@ -344,7 +344,7 @@ impl MockCookieUser {
344
344
/// A type that can generate token authenticated requests
345
345
pub struct MockTokenUser {
346
346
app : TestApp ,
347
- token : ApiToken ,
347
+ token : Option < ApiToken > ,
348
348
plaintext : String ,
349
349
}
350
350
@@ -363,7 +363,8 @@ impl RequestHelper for MockTokenUser {
363
363
impl MockTokenUser {
364
364
/// Returns a reference to the database `ApiToken` model
365
365
pub fn as_model ( & self ) -> & ApiToken {
366
- & self . token
366
+ const ERROR : & str = "Original `ApiToken` was not set on this `MockTokenUser` instance" ;
367
+ self . token . as_ref ( ) . expect ( ERROR )
367
368
}
368
369
369
370
pub fn plaintext ( & self ) -> & str {
You can’t perform that action at this time.
0 commit comments