Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bprize15 committed Dec 9, 2024
1 parent 53351ca commit ff5d596
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/java/org/mskcc/cbio/oncokb/service/CompanyServiceIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,32 @@ public void assertThatRegularUserStatusRemainTheSameAfterLinkedWithTrialCompany(
assertThat(latestUserDTO.isActivated()).isTrue();
}

@Test
@Transactional
public void assertThatCreatingNewServiceAccountTokenAlsoCreatesServiceAccount() {
CompanyDTO company = companyService.createCompany(companyDTO);
assertThat(company.getServiceUsers().size() == 0);

// Should create service user and new token
Long id = company.getId();
Token token = companyService.createServiceAccountToken(company.getId(), "New token").get();
company = companyService.findOne(company.getId()).get();
assertThat(company.getServiceUsers().size() == 1);
assertThat(tokenService.findByToken(token.getToken()).get().getName() == "New token");
}

@Test
@Transactional
public void assertThatOnlyOneServiceUserCanBeCreatedPerCompany() {
CompanyDTO company = companyService.createCompany(companyDTO);
assertThat(company.getServiceUsers().size() == 0);

companyService.createServiceAccount(company.getId());
company = companyService.findOne(company.getId()).get();
assertThat(company.getServiceUsers().size() == 1);

companyService.createServiceAccount(company.getId());
company = companyService.findOne(company.getId()).get();
assertThat(company.getServiceUsers().size() == 1);
}
}

0 comments on commit ff5d596

Please sign in to comment.