-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dmytro Marchuk
committed
Jul 4, 2023
1 parent
5f34ea2
commit d877d1e
Showing
15 changed files
with
148 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Push to DockerHub | ||
on: [ push ] | ||
env: | ||
DOCKER_USER: ${{secrets.DOCKER_USER}} | ||
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | ||
jobs: | ||
push-to-docker-hub: | ||
runs-on: ubuntu-latest | ||
if: ${{ contains(github.event.head_commit.message, '#test') }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 11 | ||
cache: gradle | ||
- name: Code build | ||
run: ./gradlew build --no-daemon -x test -x check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/test/kotlin/io/github/smaugfm/lunchmoney/JsonSchemaUpToDateTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package io.github.smaugfm.lunchmoney | ||
|
||
import assertk.assertThat | ||
import assertk.assertions.hasSize | ||
import assertk.assertions.isEqualTo | ||
import assertk.assertions.isTrue | ||
import assertk.assertions.prop | ||
import io.github.smaugfm.lunchmoney.api.LunchmoneyApi | ||
import io.github.smaugfm.lunchmoney.model.LunchmoneyCategorySingle | ||
import io.github.smaugfm.lunchmoney.model.LunchmoneyUser | ||
import org.junit.jupiter.api.BeforeAll | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable | ||
import reactor.tools.agent.ReactorDebugAgent | ||
|
||
@EnabledIfEnvironmentVariable(named = "LUNCHMONEY_TEST_TOKEN", matches = "\\w+") | ||
class JsonSchemaUpToDateTest { | ||
|
||
companion object { | ||
@JvmStatic | ||
@BeforeAll | ||
fun initReactor() { | ||
ReactorDebugAgent.init() | ||
} | ||
} | ||
|
||
private val api = LunchmoneyApi(System.getenv("LUNCHMONEY_TEST_TOKEN")) | ||
|
||
@Test | ||
fun getUserTest() { | ||
val user = api.getCurrentUser().block()!! | ||
assertThat(user).prop(LunchmoneyUser::userName) | ||
.isEqualTo("vasa") | ||
assertThat(user).prop(LunchmoneyUser::userEmail) | ||
.isEqualTo("vasa@vasa.com") | ||
assertThat(user).prop(LunchmoneyUser::budgetName) | ||
.isEqualTo("test") | ||
assertThat(user).prop(LunchmoneyUser::apiKeyLabel) | ||
.isEqualTo("Github Actions") | ||
} | ||
|
||
@Test | ||
fun getAllCategoriesTest() { | ||
val categories = api.getAllCategories().block()!! | ||
assertThat(categories) | ||
.hasSize(11) | ||
} | ||
|
||
@Test | ||
fun getSingleCategoryTest() { | ||
val cat = api.getSingleCategory(489281).block()!! | ||
assertThat(cat) | ||
.prop(LunchmoneyCategorySingle::id) | ||
.isEqualTo(489281) | ||
} | ||
|
||
@Test | ||
fun crudCategoryTest() { | ||
val catName = "test-category" | ||
val catName2 = "test-category2" | ||
val id = api.createCategory(catName, false, true, true).block()!! | ||
try { | ||
var cat = api.getSingleCategory(id).block()!! | ||
assertThat(cat) | ||
.prop(LunchmoneyCategorySingle::id) | ||
.isEqualTo(id) | ||
assertThat(cat) | ||
.prop(LunchmoneyCategorySingle::name) | ||
.isEqualTo(catName) | ||
|
||
assertThat(api.updateCategory(id, true, false, false, catName2).block()!!).isTrue() | ||
cat = api.getSingleCategory(id).block()!! | ||
assertThat(cat) | ||
.prop(LunchmoneyCategorySingle::name) | ||
.isEqualTo(catName2) | ||
|
||
} finally { | ||
assertThat(api.forceDeleteCategory(id).block()!!).isTrue() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/test/resources/response/createCategory-errorAlreadyExists.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"error": "A category with the same name (vasa) already exists." | ||
"error": [ | ||
"A category with the same name (vasa) already exists." | ||
] | ||
} |