use of cn.edu.zjnu.acm.judge.data.form.AccountImportForm in project judge by zjnu-acm.
the class AccountControllerTest method testImportUsers.
/**
* Test of importUsers method, of class AccountController.
*
* @see AccountController#importUsers(AccountImportForm)
*/
@Test
public void testImportUsers() throws Exception {
log.info("importUsers");
AccountImportForm form = new AccountImportForm();
Account account = toAccount(mockDataService.user(false));
Account account2 = toAccount(mockDataService.user(false));
form.setContent(Arrays.asList(account, account2));
expect(form, HttpStatus.OK);
account.setExists(true);
account2.setExists(true);
expect(form, HttpStatus.BAD_REQUEST);
form.setExistsPolicy(Arrays.asList(AccountImportForm.ExistPolicy.ENABLE));
expect(form, HttpStatus.OK);
}
use of cn.edu.zjnu.acm.judge.data.form.AccountImportForm in project judge by zjnu-acm.
the class AccountExcelControllerTest method testImportUsers.
/**
* Test of importUsers method, of class AccountController.
*
* {@link AccountExcelController#importUsers(AccountImportForm)}
*/
@Test
public void testImportUsers() throws Exception {
log.info("importUsers");
AccountImportForm form = new AccountImportForm();
Account account = toAccount(mockDataService.user(false));
Account account2 = toAccount(mockDataService.user(false));
form.setContent(Arrays.asList(account, account2));
expect(form, HttpStatus.NO_CONTENT);
account.setExists(true);
account2.setExists(true);
expect(form, HttpStatus.BAD_REQUEST);
form.getExistsPolicy().add(AccountImportForm.ExistPolicy.ENABLE);
expect(form, HttpStatus.NO_CONTENT);
}
Aggregations