Skip to content

Commit

Permalink
[backend] delete injector contract after test
Browse files Browse the repository at this point in the history
Signed-off-by: Marine LM <[email protected]>
  • Loading branch information
MarineLeM committed Dec 19, 2024
1 parent 864e609 commit 27f739a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions openbas-api/src/test/java/io/openbas/rest/InjectApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class InjectApiTest extends IntegrationTest {
static Team TEAM;
static String SCENARIO_INJECT_ID;
static InjectorContract PAYLOAD_INJECTOR_CONTRACT;
static InjectorContract PAYLOAD_INJECTOR_CONTRACT_2;
@Resource protected ObjectMapper mapper;
@Autowired private MockMvc mvc;
@Autowired private ScenarioService scenarioService;
Expand Down Expand Up @@ -131,7 +132,8 @@ void afterAll() {
this.exerciseRepository.delete(EXERCISE);
this.documentRepository.deleteAll(List.of(DOCUMENT1, DOCUMENT2));
this.teamRepository.delete(TEAM);
this.injectorContractRepository.delete(PAYLOAD_INJECTOR_CONTRACT);
this.injectorContractRepository.deleteAll(
List.of(PAYLOAD_INJECTOR_CONTRACT, PAYLOAD_INJECTOR_CONTRACT_2));
}

// -- SCENARIOS --
Expand Down Expand Up @@ -697,12 +699,12 @@ void getExecutableObfuscatePayloadInject() throws Exception {
InjectorContract injectorContract =
InjectorContractFixture.createPayloadInjectorContractWithObfuscator(
injector, payloadSaved);
PAYLOAD_INJECTOR_CONTRACT = injectorContractRepository.save(injectorContract);
PAYLOAD_INJECTOR_CONTRACT_2 = injectorContractRepository.save(injectorContract);

Map<String, String> payloadArguments = new HashMap<>();
payloadArguments.put("obfuscator", "base64");
Inject inject =
InjectFixture.createInjectCommandPayload(PAYLOAD_INJECTOR_CONTRACT, payloadArguments);
InjectFixture.createInjectCommandPayload(PAYLOAD_INJECTOR_CONTRACT_2, payloadArguments);

Inject injectSaved = injectRepository.save(inject);

Expand Down

0 comments on commit 27f739a

Please sign in to comment.