File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -335,7 +335,7 @@ impl MockCookieUser {
335335
336336 MockTokenUser {
337337 app : self . app . clone ( ) ,
338- token,
338+ token : Some ( token ) ,
339339 plaintext : plaintext. expose_secret ( ) . into ( ) ,
340340 }
341341 }
@@ -344,7 +344,7 @@ impl MockCookieUser {
344344/// A type that can generate token authenticated requests
345345pub struct MockTokenUser {
346346 app : TestApp ,
347- token : ApiToken ,
347+ token : Option < ApiToken > ,
348348 plaintext : String ,
349349}
350350
@@ -363,7 +363,8 @@ impl RequestHelper for MockTokenUser {
363363impl MockTokenUser {
364364 /// Returns a reference to the database `ApiToken` model
365365 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 )
367368 }
368369
369370 pub fn plaintext ( & self ) -> & str {
You can’t perform that action at this time.
0 commit comments