-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
63 changed files
with
1,936 additions
and
370 deletions.
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
83 changes: 66 additions & 17 deletions
83
src/test/java/dev/iakunin/codexiabot/codexia/cron/MissingFillerIntegrationTest.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 |
---|---|---|
@@ -1,33 +1,82 @@ | ||
package dev.iakunin.codexiabot.codexia.cron; | ||
|
||
import com.github.database.rider.core.api.dataset.DataSet; | ||
import com.github.database.rider.core.api.dataset.ExpectedDataSet; | ||
import dev.iakunin.codexiabot.AbstractIntegrationTest; | ||
import dev.iakunin.codexiabot.config.GithubConfig; | ||
import dev.iakunin.codexiabot.util.WireMockServer; | ||
import org.junit.jupiter.api.AfterEach; | ||
import dev.iakunin.codexiabot.util.wiremock.Stub; | ||
import org.cactoos.io.ResourceOf; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.util.TestPropertyValues; | ||
import org.springframework.context.ApplicationContextInitializer; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@ContextConfiguration(initializers = MissingFillerIntegrationTest.Initializer.class) | ||
@SpringBootTest(classes = { | ||
AbstractIntegrationTest.TestConfig.class, | ||
GithubConfig.class, | ||
}) | ||
public class MissingFillerIntegrationTest extends AbstractIntegrationTest { | ||
|
||
@Autowired | ||
private MissingFiller missingFiller; | ||
|
||
// @todo #10 Implement MissingFillerIntegrationTest | ||
@Test | ||
@DataSet( | ||
value = "db-rider/codexia/cron/missing-filler/initial/emptyDatabase.yml", | ||
cleanBefore = true, cleanAfter = true | ||
) | ||
@ExpectedDataSet("db-rider/codexia/cron/missing-filler/expected/emptyDatabase.yml") | ||
public void emptyDatabase() { | ||
missingFiller.run(); | ||
} | ||
|
||
@AfterEach | ||
void after() { | ||
WireMockServer.getInstance().resetAll(); | ||
@Test | ||
@DataSet( | ||
value = "db-rider/codexia/cron/missing-filler/initial/oneWithGithubRepo.yml", | ||
cleanBefore = true, cleanAfter = true | ||
) | ||
@ExpectedDataSet("db-rider/codexia/cron/missing-filler/expected/oneWithGithubRepo.yml") | ||
public void oneWithGithubRepo() { | ||
missingFiller.run(); | ||
} | ||
|
||
static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { | ||
@Override | ||
public void initialize(ConfigurableApplicationContext applicationContext) { | ||
TestPropertyValues.of( | ||
"app.codexia.base-url=" + WireMockServer.getInstance().baseUrl() | ||
).applyTo(applicationContext.getEnvironment()); | ||
} | ||
@Test | ||
@DataSet( | ||
value = "db-rider/codexia/cron/missing-filler/initial/oneWithoutGithubRepo.yml", | ||
cleanBefore = true, cleanAfter = true | ||
) | ||
@ExpectedDataSet("db-rider/codexia/cron/missing-filler/expected/oneWithoutGithubRepo.yml") | ||
public void oneWithoutGithubRepo() { | ||
WireMockServer.stub( | ||
new Stub( | ||
"/github/repos/instaloader/instaloader", | ||
new ResourceOf("wiremock/codexia/cron/missing-filler/instaloader.json") | ||
) | ||
); | ||
|
||
missingFiller.run(); | ||
} | ||
|
||
@Test | ||
@DataSet( | ||
value = "db-rider/codexia/cron/missing-filler/initial/twoWithoutGithubRepo.yml", | ||
cleanBefore = true, cleanAfter = true | ||
) | ||
@ExpectedDataSet("db-rider/codexia/cron/missing-filler/expected/twoWithoutGithubRepo.yml") | ||
public void twoWithoutGithubRepo() { | ||
WireMockServer.stub( | ||
new Stub( | ||
"/github/repos/instaloader/instaloader", | ||
new ResourceOf("wiremock/codexia/cron/missing-filler/instaloader.json") | ||
) | ||
); | ||
WireMockServer.stub( | ||
new Stub( | ||
"/github/repos/arpit9667/algorithms-js", | ||
new ResourceOf("wiremock/codexia/cron/missing-filler/algorithms-js.json") | ||
) | ||
); | ||
|
||
missingFiller.run(); | ||
} | ||
} |
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
Oops, something went wrong.
4187d38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
10-5ffba3e0
disappeared fromsrc/test/java/dev/iakunin/codexiabot/codexia/cron/MissingFillerIntegrationTest.java
, that's why I closed #55. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.4187d38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
10-c5423926
disappeared fromsrc/test/java/dev/iakunin/codexiabot/codexia/cron/ResendErroneousReviewsIntegrationTest.java
, that's why I closed #56. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.4187d38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
10-e69f73e3
disappeared fromsrc/test/java/dev/iakunin/codexiabot/github/cron/stat/GithubIntegrationTest.java
, that's why I closed #59. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.4187d38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
10-d5175438
disappeared fromsrc/test/java/dev/iakunin/codexiabot/reddit/cron/ParserIntegrationTest.java
, that's why I closed #60. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.