Skip to content

Commit c6e99f7

Browse files
authored
Merge pull request #1852 from bibonix/fix-1036-public-repos-path
#1036: fix path for listing public repositories
2 parents 7ce9302 + bafbc75 commit c6e99f7

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/main/java/com/jcabi/github/RtRepos.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public void remove(
9696
public Iterable<Repo> iterate(
9797
final String identifier) {
9898
return new RtPagination<>(
99-
this.entry.uri().queryParam("since", identifier).back(),
99+
this.entry.uri().path("/repositories")
100+
.queryParam("since", identifier).back(),
100101
object -> this.get(
101102
new Coordinates.Simple(object.getString("full_name"))
102103
)

src/test/java/com/jcabi/github/RtReposTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,34 @@ void iterateRepos() throws IOException {
9292
}
9393
}
9494

95+
@Test
96+
void iterateReposUsesPublicRepositoriesPath() throws IOException {
97+
final String identifier = "364";
98+
try (
99+
MkContainer container = new MkGrizzlyContainer().next(
100+
new MkAnswer.Simple(
101+
HttpURLConnection.HTTP_OK,
102+
Json.createArrayBuilder()
103+
.add(RtReposTest.response("octocat", identifier))
104+
.build().toString()
105+
)
106+
).start(RandomPort.port())
107+
) {
108+
new RtRepos(
109+
Mockito.mock(GitHub.class),
110+
new ApacheRequest(container.home())
111+
).iterate(identifier).iterator().next();
112+
MatcherAssert.assertThat(
113+
"iterate(...) must request /repositories?since=<id>",
114+
container.take().uri().toString(),
115+
Matchers.endsWith(
116+
"/repositories?since=".concat(identifier)
117+
)
118+
);
119+
container.stop();
120+
}
121+
}
122+
95123
@Test
96124
void removeRepo() throws IOException {
97125
try (

0 commit comments

Comments
 (0)