Skip to content

Commit

Permalink
[#1459] Add test placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed Feb 8, 2024
1 parent b848de8 commit e6da7c0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/rultor/agents/github/qtn/CheckablePull.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public boolean allChecksSuccessful() throws IOException {
*/
public boolean containsFile(final String file) throws IOException {
boolean result = false;
for (final JsonObject jfile : this.pull.files()) {
if (jfile.getString("filename").equalsIgnoreCase(file)) {
for (final JsonObject pullfile : this.pull.files()) {
if (pullfile.getString("filename").equalsIgnoreCase(file)) {
result = true;
break;
}
Expand Down
46 changes: 46 additions & 0 deletions src/test/java/com/rultor/agents/github/qtn/QnMergeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.LinkedList;
import java.util.List;
import java.util.ResourceBundle;
import javax.json.Json;
import javax.json.JsonObject;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.xembly.Directives;
import org.xembly.Xembler;
Expand Down Expand Up @@ -186,6 +191,47 @@ public void continuesBecauseCiChecksSuccessful()
);
}

/**
* QnMerge can not build a request because .rultor file is changed.
* @todo #1459 Enable this test after com.jcabi.github.mock.MkPull
* change to allow to work with the files
* @throws IOException In case of I/O error
* @throws URISyntaxException In case of URI error
*/
@Test
@Disabled
public void stopsBecauseSystemFilesAffected()
throws IOException, URISyntaxException {
final MkChecks checks = (MkChecks) this.pull.checks();
checks.create(Check.Status.COMPLETED, Check.Conclusion.SUCCESS);
final List<JsonObject> files = new LinkedList<>();
files.add(Json.createObjectBuilder()
.add("sha", "ef36558cbd")
.add("filename", "README.md")
.add("status", "modified")
.build()
);
files.add(Json.createObjectBuilder()
.add("sha", "ef3857cad")
.add("filename", ".rultor.yml")
.add("status", "modified")
.build()
);
this.mergeRequest();
MatcherAssert.assertThat(
new Comment.Smart(this.comments.get(1)).body(),
Matchers.is(QnMergeTest.COMMAND)
);
MatcherAssert.assertThat(
new Comment.Smart(this.comments.get(2)).body(),
Matchers.containsString(
QnMergeTest.PHRASES.getString(
"QnMerge.system-files-affected"
)
)
);
}

/**
* Merge request directives.
* @return Directives
Expand Down

0 comments on commit e6da7c0

Please sign in to comment.