Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 5f2c84a

Browse files
committed
Tests should use test repositories for mutating tests.
Picking up the first random repository you are an owner of and making a change to it is too dangerous.
1 parent 3011c99 commit 5f2c84a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/test/java/org/kohsuke/github/AppTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public void testQueryCommits() throws Exception {
351351
sha1.add(c.getSHA1());
352352
}
353353
assertEquals("1cccddb22e305397151b2b7b87b4b47d74ca337b",sha1.get(0));
354-
assertEquals(29,sha1.size());
354+
assertEquals(29, sha1.size());
355355
}
356356

357357
@Test
@@ -618,7 +618,7 @@ public void directoryListing() throws IOException {
618618

619619
@Test
620620
public void testAddDeployKey() throws IOException {
621-
GHRepository myRepository = Iterables.get(gitHub.getMyself().getRepositories().values(),0);
621+
GHRepository myRepository = getTestRepository();
622622
final GHDeployKey newDeployKey = myRepository.addDeployKey("test", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUt0RAycC5cS42JKh6SecfFZBR1RrF+2hYMctz4mk74/arBE+wFb7fnSHGzdGKX2h5CFOWODifRCJVhB7hlVxodxe+QkQQYAEL/x1WVCJnGgTGQGOrhOMj95V3UE5pQKhsKD608C+u5tSofcWXLToP1/wZ7U4/AHjqYi08OLsWToHCax55TZkvdt2jo0hbIoYU+XI9Q8Uv4ONDN1oabiOdgeKi8+crvHAuvNleiBhWVBzFh8KdfzaH5uNdw7ihhFjEd1vzqACsjCINCjdMfzl6jD9ExuWuE92nZJnucls2cEoNC6k2aPmrZDg9hA32FXVpyseY+bDUWFU6LO2LG6PB kohsuke@atlas");
623623
try {
624624
assertNotNull(newDeployKey.getId());
@@ -636,7 +636,7 @@ public boolean apply(GHDeployKey deployKey) {
636636

637637
@Test
638638
public void testCommitStatusContext() throws IOException {
639-
GHRepository myRepository = Iterables.get(gitHub.getMyself().getRepositories().values(), 0);
639+
GHRepository myRepository = getTestRepository();
640640
GHRef masterRef = myRepository.getRef("heads/master");
641641
GHCommitStatus commitStatus = myRepository.createCommitStatus(masterRef.getObject().getSha(), GHCommitState.SUCCESS, "http://www.example.com", "test", "test/context");
642642
assertEquals("test/context", commitStatus.getContext());

0 commit comments

Comments
 (0)