Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: implement Default or add a constructor to Session for testing #252

Open
kingledion opened this issue Jun 10, 2022 · 0 comments · May be fixed by #253
Open

Feature request: implement Default or add a constructor to Session for testing #252

kingledion opened this issue Jun 10, 2022 · 0 comments · May be fixed by #253
Labels
A-session Project: actix-session C-feature Category: new functionality

Comments

@kingledion
Copy link

In my project, I created a trait and implemented it for the Session struct that added some basic functionality customized to my use case (in this case, validating a user id and expiration time against the SessionStore, for authentication purposes).

I wanted to package this trait as a library to use in multiple microservices, and build unit tests for it. But I am getting stuck in that I cannot see a way to create an instance of Session for my tests. There is no constructor, the Session{...} syntax does not work due to private fields, and I can't seem to get a way to create one via an HttpRequest (which also does not appear to have a constructor) within a unit test.

I'm going to propose a PR to do this shortly, but I wanted to add an issue explaining what I was doing.

@kingledion kingledion linked a pull request Jun 10, 2022 that will close this issue
4 tasks
@robjtede robjtede added A-session Project: actix-session C-feature Category: new functionality labels Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-session Project: actix-session C-feature Category: new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants