-
Notifications
You must be signed in to change notification settings - Fork 3
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
Mock Oauth Unit Tests #158
base: master
Are you sure you want to change the base?
Conversation
@@ -1,5 +1,5 @@ | |||
spring.jpa.show-sql=true | |||
spring.jpa.hibernate.ddl-auto=update | |||
app.admin.emails=phtcon@ucsb.edu | |||
app.admin.emails=tkomarlu@ucsb.edu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be mistaken, but I think this supports a comma separated list. So I wonder if you might consider:
app.admin.emails=phtcon@ucsb.edu,tkomarlu@ucsb.edu
Also, you can can override this at run time, which might be a better way of handling this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a line to the README.md
that explains that you can override app.admin.emails
in localhost.json
// Now check that the name in the header is Joe | ||
mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.TEXT_HTML)).andExpect(status().isOk()) | ||
.andExpect(content().contentType("text/html;charset=UTF-8")) | ||
.andExpect(xpath("/html/body/div[@class='container']/nav[@class='navbar navbar-expand-lg navbar-light bg-light']/div[@id='navbarTogglerDemo03']/ul[@class='nav navbar-nav navbar-right']/li[1]/a") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to try the least specific selector that will find the content. Otherwise, the tests become brittle ... i.e. any tiny change to the HTML causes the test to break. At some, you are just writing the code twice...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely see if you can find the least specific selector that gets the job done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider the feedback, otherwise LGTU
@@ -1,5 +1,5 @@ | |||
spring.jpa.show-sql=true | |||
spring.jpa.hibernate.ddl-auto=update | |||
app.admin.emails=phtcon@ucsb.edu | |||
app.admin.emails=tkomarlu@ucsb.edu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a line to the README.md
that explains that you can override app.admin.emails
in localhost.json
// Now check that the name in the header is Joe | ||
mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.TEXT_HTML)).andExpect(status().isOk()) | ||
.andExpect(content().contentType("text/html;charset=UTF-8")) | ||
.andExpect(xpath("/html/body/div[@class='container']/nav[@class='navbar navbar-expand-lg navbar-light bg-light']/div[@id='navbarTogglerDemo03']/ul[@class='nav navbar-nav navbar-right']/li[1]/a") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely see if you can find the least specific selector that gets the job done.
This pr adds unit tests that mock the user authentication services and verify that users can access the correct endpoints.