Geoffrey De Smet created ARQ-739:
------------------------------------
Summary: Login simulation in tests with @LoginAs("username",
"password") and an authenticated servlet protocol
Key: ARQ-739
URL:
https://issues.jboss.org/browse/ARQ-739
Project: Arquillian
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Geoffrey De Smet
Motivation:
1) Testing the similar functionality under different logins (and therefore roles) should
be easy.
2) Each in-container test is scope request.
If you inject a request or session scoped bean in the test, that requires an Identity to
be injected, it will be created with a dummy Identity (username = null).
This can leave the bean in an illegal state (especially when using @PostConstruct or
@Produces).
Proposal A:
{code}
@Deployment @OverProtocol("Authenticated Servlet")
public static WebArchive createDeployment() {...}
@Test @LoginAs("admin", "admin")
public void changeThemeAsAdmin() {...}
@Test(exception = AuthenticationException.class) @LoginAs("guest",
"guest")
public void changeThemeAsGuest() {...}
{code}
Furthermore, @LoginAs should also be defaultable for all tests on the class itself:
{code}
@LoginAs("admin", "admin")
public class MyTest {
@Deployment @OverProtocol("Authenticated Servlet")
public static WebArchive createDeployment() {...}
@Test
public void changeThemeAsAdmin() {...}
@Test
public void changeImportAsAdmin() {...}
...
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira