Added getting Pinboard API token from (CircleCI) environment variable.
This commit is contained in:
parent
1cfda5f72b
commit
1d36d78bf4
2 changed files with 21 additions and 8 deletions
|
@ -27,5 +27,11 @@ jobs:
|
|||
key: kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }}
|
||||
|
||||
- run:
|
||||
name: Assemble
|
||||
command: ./kobaltw assemble
|
||||
name: Assemble & Test
|
||||
command: ./kobaltw assemble test
|
||||
|
||||
- store_artifacts:
|
||||
path: kobaltBuild/test-output/
|
||||
destination: test-output
|
||||
- store_test_results:
|
||||
path: kobaltBuild/test-output/
|
||||
|
|
|
@ -34,15 +34,22 @@ package net.thauvin.erik.pinboard
|
|||
import org.testng.Assert
|
||||
import org.testng.annotations.Test
|
||||
import java.io.FileInputStream
|
||||
import java.util.*
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.Properties
|
||||
|
||||
class PinboardPosterTest {
|
||||
private val url = "http://www.foo.com/"
|
||||
private val desc = "This is a test."
|
||||
private val p = Properties().apply { FileInputStream("local.properties").use { fis -> load(fis) } }
|
||||
private val apiToken = p.getProperty("pinboard-api-token")
|
||||
|
||||
@Test
|
||||
private val localProps = Paths.get("local.properties")
|
||||
private val apiToken = if (Files.exists(localProps)) {
|
||||
val p = Properties().apply { Files.newInputStream(localProps).use { fis -> load(fis) }}
|
||||
p.getProperty("pinboard-api-token", "")
|
||||
} else {
|
||||
System.getenv("PINBOARD_API_TOKEN")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAddPin() {
|
||||
val poster = PinboardPoster("")
|
||||
|
||||
|
@ -70,4 +77,4 @@ class PinboardPosterTest {
|
|||
|
||||
Assert.assertFalse(poster.deletePin("foo.com"), "url: foo.com")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue