Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

Commit

Permalink
Add @OnlyWhen to tests with private key
Browse files Browse the repository at this point in the history
  • Loading branch information
blindpirate committed Feb 25, 2017
1 parent 61236a0 commit 0a50f09
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.github.blindpirate.gogradle.util
import com.github.blindpirate.gogradle.GitRepositoryHandler
import com.github.blindpirate.gogradle.GogradleRunner
import com.github.blindpirate.gogradle.support.AccessWeb
import com.github.blindpirate.gogradle.support.OnlyWhen
import com.github.blindpirate.gogradle.support.WithMockInjector
import com.github.blindpirate.gogradle.support.WithResource
import com.github.blindpirate.gogradle.vcs.git.GitAccessor
Expand Down Expand Up @@ -231,22 +232,22 @@ class GitAccessorTest {
@Test
@AccessWeb
@WithResource('')
@OnlyWhen("System.getenv('MY_OWN_PRIVATE_KEY')!=null")
void 'cloning with ssh private key should succeed'() {
if (System.getenv('MY_OWN_PRIVATE_KEY')) {
GitRepository gitRepo = new GitRepository()
gitRepo.all()
gitRepo.privateKeyFile(System.getenv('MY_OWN_PRIVATE_KEY'))
addOneRepo(gitRepo)
GitRepository gitRepo = new GitRepository()
gitRepo.all()
gitRepo.privateKeyFile(System.getenv('MY_OWN_PRIVATE_KEY'))
addOneRepo(gitRepo)

gitAccessor.cloneWithUrl('name', 'git@github.com:adieu/archon-ui-ruff.git', resource)
gitAccessor.hardResetAndPull('name', gitAccessor.getRepository(resource))
assert new File(resource, 'README.md').exists()
}
gitAccessor.cloneWithUrl('name', 'git@github.com:adieu/archon-ui-ruff.git', resource)
gitAccessor.hardResetAndPull('name', gitAccessor.getRepository(resource))
assert new File(resource, 'README.md').exists()
}

@Test
@AccessWeb
@WithResource('')
@OnlyWhen("System.getenv('MY_GITHUB_PASSWORD')!=null")
void 'cloning with username and password should succeed'() {
if (System.getenv('MY_GITHUB_PASSWORD')) {
GitRepository gitRepo = new GitRepository()
Expand Down

0 comments on commit 0a50f09

Please sign in to comment.