Skip to content

Commit

Permalink
Fix CLI test creating a new file in the source dir (LangStream#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi committed Sep 4, 2023
1 parent 77858f2 commit 0f3e64d
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.github.tomakehurst.wiremock.client.WireMock;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -1132,13 +1133,20 @@ public void testDownload() {
WireMock.get("/api/applications/%s/my-app/code".formatted(TENANT))
.willReturn(WireMock.ok()));

CommandResult result = executeCommand("apps", "download", "my-app");
Assertions.assertEquals(0, result.exitCode());
Assertions.assertEquals("", result.err());
Assertions.assertEquals(
"Downloaded application code to "
+ new File("%s-my-app.zip".formatted(TENANT)).getAbsolutePath(),
result.out());
final File expectedFile = new File("%s-my-app.zip".formatted(TENANT));
try {
CommandResult result = executeCommand("apps", "download", "my-app");
Assertions.assertEquals(0, result.exitCode());
Assertions.assertEquals("", result.err());
Assertions.assertEquals(
"Downloaded application code to " + expectedFile.getAbsolutePath(),
result.out());
} finally {
try {
Files.deleteIfExists(expectedFile.toPath());
} catch (IOException e) {
}
}
}

@Test
Expand Down

0 comments on commit 0f3e64d

Please sign in to comment.