forked from apitable/apitable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: delete automation trigger (apitable#1657)
Co-authored-by: Zoe <[email protected]>
- Loading branch information
Showing
6 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
.../src/test/java/com/apitable/automation/service/impl/AutomationTriggerServiceImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.apitable.automation.service.impl; | ||
|
||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.apitable.AbstractIntegrationTest; | ||
import com.apitable.automation.entity.AutomationTriggerEntity; | ||
import com.apitable.automation.model.AutomationTriggerDto; | ||
import com.apitable.mock.bean.MockUserSpace; | ||
import com.apitable.shared.util.IdUtil; | ||
import com.baomidou.mybatisplus.core.toolkit.IdWorker; | ||
import java.math.BigInteger; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class AutomationTriggerServiceImplTest extends AbstractIntegrationTest { | ||
@Test | ||
public void testDeleteAutomationTrigger() { | ||
MockUserSpace userSpace = createSingleUserAndSpace(); | ||
AutomationTriggerEntity trigger = AutomationTriggerEntity.builder() | ||
.id(BigInteger.valueOf(IdWorker.getId())) | ||
.robotId(IdUtil.createAutomationRobotId()) | ||
.triggerId(IdUtil.createAutomationTriggerId()) | ||
.triggerTypeId(IdUtil.createAutomationTriggerTypeId()) | ||
.build(); | ||
iAutomationTriggerService.create(trigger); | ||
iAutomationTriggerService.deleteByTriggerId(trigger.getRobotId(), trigger.getTriggerId(), | ||
userSpace.getUserId()); | ||
List<AutomationTriggerDto> triggers = iAutomationTriggerService.getTriggersByRobotIds( | ||
Collections.singletonList(trigger.getRobotId())); | ||
assertThat(triggers).isEmpty(); | ||
} | ||
} |