Skip to content
Snippets Groups Projects
Commit 879f74c3 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

add a few tests and disable csrf when authentication is disabled

parent 37040407
No related branches found
No related tags found
No related merge requests found
......@@ -121,7 +121,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
else {
http.antMatcher("/**")
.authorizeRequests()
.antMatchers("/**").permitAll();
.antMatchers("/**").permitAll().and().csrf().disable();
getUser();
}
}
......
......@@ -7,6 +7,10 @@ GROUPS_REF="{\"code\":\"root\",\"groups\":[{\"code\":\"tg1\",\"label\":\"Test Gr
VARIABLES_REF="[{\"code\":\"tv1\",\"label\":\"Test Variable 1\",\"type\":\"text\",\"group\":{\"code\":\"tg3\",\"label\":\"Test Group 3\"},\"isVariable\":true},{\"code\":\"tv2\",\"label\":\"Test Variable 2\",\"type\":\"integer\",\"group\":{\"code\":\"tg4\",\"label\":\"Test Group 4\"},\"isVariable\":true},{\"code\":\"tv3\",\"label\":\"Test Variable 3\",\"type\":\"real\",\"group\":{\"code\":\"tg4\",\"label\":\"Test Group 4\"},\"isVariable\":true}]"
STATS_REF="{\"users\":0,\"articles\":0,\"variables\":3}"
VARIABLES_HIERARCHY_REF="{\"code\":\"root\",\"groups\":[{\"code\":\"tg1\",\"label\":\"Test Group 1\",\"groups\":[{\"code\":\"tg3\",\"label\":\"Test Group 3\",\"variables\":[{\"code\":\"tv1\",\"label\":\"Test Variable 1\",\"type\":\"text\"}]}]},{\"code\":\"tg2\",\"label\":\"Test Group 2\",\"groups\":[{\"code\":\"tg4\",\"label\":\"Test Group 4\",\"variables\":[{\"code\":\"tv2\",\"label\":\"Test Variable 2\",\"type\":\"integer\"},{\"code\":\"tv3\",\"label\":\"Test Variable 3\",\"type\":\"real\"}]}]}]}"
# Get gateway IP
......@@ -29,6 +33,22 @@ if [ "$(curl -s ${GATEWAY_IP}:65434/services/variables)" != "$VARIABLES_REF" ];
fi
# Test - GET stats
if [ "$(curl -s ${GATEWAY_IP}:65434/services/stats)" != "$STATS_REF" ]; then
echo "Tests failed - failed to load stats"
exit 1
fi
# Test - GET variables hierarchy
if [ "$(curl -s ${GATEWAY_IP}:65434/services/variables/hierarchy)" != "$VARIABLES_HIERARCHY_REF" ]; then
echo "Tests failed - failed to load variables hierarchy"
exit 1
fi
echo "Tests successfully passed"
exit 0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment