Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,75 @@ public void testCommitMustBeComplete() throws DisabledPluginException, IOExcepti
}
}

@Test
public void testRepositoryMustBeGithubCloneUrl() throws DisabledPluginException, IOException
{
try
{
newPlugin("test", "" +
"repository=https://gitlab.com/runelite/example-plugin.git\n" +
"commit=0000000000000000000000000000000000000000");
Assert.fail();
}
catch (PluginBuildException e)
{
log.info("ok: ", e);
assertContains(e.getMessage(), "repository is not an accepted url");
assertContains(e.getHelpText(), "repositories must be hosted on GitHub.com");
}
}

@Test
public void testUnexpectedCommitDescriptorKeyFailsFast() throws DisabledPluginException, IOException
{
try
{
newPlugin("test", "" +
"repository=https://github.com/runelite/example-plugin.git\n" +
"commit=0000000000000000000000000000000000000000\n" +
"commmit=0000000000000000000000000000000000000000");
Assert.fail();
}
catch (PluginBuildException e)
{
log.info("ok: ", e);
assertContains(e.getMessage(), "unexpected key in commit descriptor");
assertContains(e.getHelpText(), "commmit=0000000000000000000000000000000000000000");
}
}

@Test
public void testDisabledCommitDescriptorIsExcludedFromUnavailable() throws PluginBuildException, IOException
{
try
{
newPlugin("disabled-plugin", "disabled=legacy plugin is broken");
Assert.fail();
}
catch (DisabledPluginException e)
{
Assert.assertEquals("disabled-plugin", e.getInternalName());
Assert.assertEquals("legacy plugin is broken", e.getReason());
Assert.assertFalse(e.isIncludeInUnavailable());
}
}

@Test
public void testUnavailableCommitDescriptorIsIncludedInUnavailable() throws PluginBuildException, IOException
{
try
{
newPlugin("unavailable-plugin", "unavailable=requires unsupported upstream API");
Assert.fail();
}
catch (DisabledPluginException e)
{
Assert.assertEquals("unavailable-plugin", e.getInternalName());
Assert.assertEquals("requires unsupported upstream API", e.getReason());
Assert.assertTrue(e.isIncludeInUnavailable());
}
}

@Test
public void testExamplePluginCompiles() throws DisabledPluginException, PluginBuildException, IOException, InterruptedException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,30 @@ public void createClientWithCredentials() throws IOException, InterruptedExcepti
RecordedRequest r2 = server.takeRequest();
Assert.assertEquals("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", r2.getHeader("Authorization"));
}

@Test
public void mkdirsCreatesMissingParentBeforeRetryingChild() throws IOException, InterruptedException
{
MockWebServer server = new MockWebServer();

server.enqueue(new MockResponse().setResponseCode(409));
server.enqueue(new MockResponse().setResponseCode(201));
server.enqueue(new MockResponse().setResponseCode(201));

UploadConfiguration uploadConfiguration = new UploadConfiguration()
.setClient("Aladdin:open sesame");

uploadConfiguration.mkdirs(server.url("/plugins/example"));

RecordedRequest childAttempt = server.takeRequest();
RecordedRequest parentAttempt = server.takeRequest();
RecordedRequest childRetry = server.takeRequest();

Assert.assertEquals("MKCOL", childAttempt.getMethod());
Assert.assertEquals("MKCOL", parentAttempt.getMethod());
Assert.assertEquals("MKCOL", childRetry.getMethod());
Assert.assertEquals("/plugins/example/%2F", childAttempt.getPath());
Assert.assertEquals("/plugins/%2F", parentAttempt.getPath());
Assert.assertEquals("/plugins/example/%2F", childRetry.getPath());
}
}
3 changes: 3 additions & 0 deletions plugins/grand-flip-out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
repository=https://github.com/Tunatroll/grand-flip-out.git
commit=1d2649de4cb8cdac32a771b6e6fcb9396e32fdc1
warning=This plugin submits your IP address to a 3rd-party server not controlled or verified by RuneLite developers.