Commit ef989775 by Anton Sudak

Update tests

parent 035c59f4
......@@ -24,10 +24,9 @@ import ch.insign.playauth.authz.utils.TestDatabase;
import ch.insign.playauth.controllers.actions.RequiresAuthenticationAction;
import ch.insign.playauth.controllers.actions.WithSubjectAction;
import ch.insign.playauth.inject.*;
import ch.insign.playauth.party.ISOGender;
import ch.insign.playauth.party.Party;
import ch.insign.playauth.party.PartyType;
import ch.insign.playauth.party.address.EmailAddress;
import ch.insign.playauth.party.PartyService;
import ch.insign.playauth.party.support.DefaultParty;
import com.google.common.base.Throwables;
import org.apache.shiro.authc.*;
import org.junit.Rule;
......@@ -88,13 +87,12 @@ public class AuthTest extends WithApplication {
new DomainObjectRetrievalStrategyModule(),
new EventDispatcherModule(),
new OidSidRetrievalStrategyModule(),
new PartyManagerModule(),
new PartyServiceModule(),
new PartyRoleManagerModule(),
new PermissionManagerModule(),
new PlayAuthApiModule(),
new PlayShiroApiModule()
)
.bindings(new PlayAuthModule())
.build();
}
......@@ -254,21 +252,27 @@ public class AuthTest extends WithApplication {
}
private Party createLockedParty() {
Party party = playAuthApi().getPartyManager().create("Locked Party", PARTY_PWD, new EmailAddress("locked@insign.ch"), ISOGender.MALE, PartyType.PERSON);
DefaultParty party = new DefaultParty();
party.setName("Locked Party");
party.setEmail("locked@insign.ch");
party.setCredentials(PARTY_PWD);
party.setLocked(true);
return party;
return instanceOf(PartyService.class).save(party);
}
private Party createUnlockedParty() {
Party party = playAuthApi().getPartyManager().create("Unlocked Party", PARTY_PWD, new EmailAddress("unlocked@insign.ch"), ISOGender.MALE, PartyType.PERSON);
DefaultParty party = new DefaultParty();
party.setName("Unlocked Party");
party.setEmail("unlocked@insign.ch");
party.setCredentials(PARTY_PWD);
party.setLocked(false);
return party;
return instanceOf(PartyService.class).save(party);
}
private PlayAuthApi playAuthApi() {
return app.injector().instanceOf(PlayAuthApi.class);
return instanceOf(PlayAuthApi.class);
}
/**
......@@ -281,12 +285,12 @@ public class AuthTest extends WithApplication {
@Override
protected PlayAuthApi getPlayAuthApi() {
return app.injector().instanceOf(PlayAuthApi.class);
return instanceOf(PlayAuthApi.class);
}
@Override
protected AuthorizationHandler getAuthorizationHandler() {
return app.injector().instanceOf(AuthorizationHandler.class);
return instanceOf(AuthorizationHandler.class);
}
@Override
......
Markdown is supported
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