-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
29 changed files
with
213 additions
and
0 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 @@ | ||
wf74SQKHyZigGSevWnQKPxBtfCP8BdukG0yKPYi9vOs= |
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,30 @@ | ||
import pytest | ||
|
||
from click.testing import CliRunner | ||
from ruamel.yaml import YAML | ||
|
||
from konverter.__main__ import cli | ||
|
||
|
||
def pytest_collect_file(parent, path): | ||
if path.ext == ".yaml" and path.basename.startswith("test_"): | ||
return E2ETest(path.basename, path, parent) | ||
|
||
|
||
class E2ETest(pytest.Item): | ||
def __init__(self, name, fspath, parent): | ||
super().__init__(name, parent) | ||
self.fspath = fspath | ||
*_, identifier = str(fspath.basename).partition("_") | ||
self.expect_path = f"{fspath.dirname}/expect_{identifier}" | ||
|
||
def runtest(self): | ||
runner = CliRunner() | ||
result = runner.invoke(cli, [str(self.fspath)]) | ||
assert result.exit_code == 0, result.output | ||
with open(self.expect_path) as expect_file: | ||
assert result.output == expect_file.read() | ||
|
||
@property | ||
def nodeid(self): | ||
return f"e2e::{self.fspath.basename}" |
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,10 @@ | ||
--- | ||
variable: Hello World! | ||
VARIABLE: HELLO WORLD! | ||
b64_variable: SGVsbG8gV29ybGQh | ||
json_variable: '{"number": 42, "other": "FOOBAR"}' | ||
|
||
template: |- | ||
Hello World! | ||
42 |
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,12 @@ | ||
--- | ||
variable: Hello World! | ||
VARIABLE: HELLO WORLD! | ||
b64_variable: SGVsbG8gV29ybGQh | ||
json_variable: '{"number": 43, "other": "BARFOO"}' | ||
|
||
template: |- | ||
Hello World! | ||
43 | ||
Hello context! |
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,11 @@ | ||
--- | ||
json_variable: '{"number": 42, "other": "FOOBAR"}' | ||
|
||
template: |- | ||
Hello World! | ||
42 | ||
--- | ||
variable: Hello World! | ||
VARIABLE: HELLO WORLD! | ||
b64_variable: SGVsbG8gV29ybGQh |
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,11 @@ | ||
--- | ||
json_variable: '{"number": 42, "other": "FOOBAR"}' | ||
|
||
template: |- | ||
Hello World! | ||
42 | ||
--- | ||
variable: Hello World! | ||
VARIABLE: HELLO WORLD! | ||
b64_variable: SGVsbG8gV29ybGQh |
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,3 @@ | ||
--- | ||
encrypted_value: Hello Secret! | ||
unencrypted_value: Hello unencryted secret! |
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,11 @@ | ||
--- | ||
variable: Hello World! | ||
VARIABLE: HELLO WORLD! | ||
b64_variable: SGVsbG8gV29ybGQh | ||
--- | ||
json_variable: '{"number": 42, "other": "FOOBAR"}' | ||
|
||
template: |- | ||
Hello World! | ||
42 |
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,11 @@ | ||
--- | ||
variable: Hello World! | ||
VARIABLE: HELLO WORLD! | ||
b64_variable: SGVsbG8gV29ybGQh | ||
--- | ||
json_variable: '{"number": 42, "other": "FOOBAR"}' | ||
|
||
template: |- | ||
Hello World! | ||
42 |
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,9 @@ | ||
variable: !k/expr foobar | ||
VARIABLE: !k/expr foobar|upper | ||
b64_variable: !k/expr foobar|b64encode | ||
json_variable: !k/expr object|to_json | ||
|
||
template: !k/template |- | ||
{{ foobar }} | ||
{{ object.number }} |
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,11 @@ | ||
variable: !k/expr foobar | ||
VARIABLE: !k/expr foobar|upper | ||
b64_variable: !k/expr foobar|b64encode | ||
json_variable: !k/expr object|to_json | ||
|
||
template: !k/template |- | ||
{{ foobar }} | ||
{{ object.number }} | ||
{{ barfoo }} |
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,6 @@ | ||
json_variable: !k/expr object|to_json | ||
|
||
template: !k/template |- | ||
{{ foobar }} | ||
{{ object.number }} |
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,3 @@ | ||
variable: !k/expr foobar | ||
VARIABLE: !k/expr foobar|upper | ||
b64_variable: !k/expr foobar|b64encode |
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,6 @@ | ||
json_variable: !k/expr object|to_json | ||
|
||
template: !k/template |- | ||
{{ foobar }} | ||
{{ object.number }} |
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,3 @@ | ||
variable: !k/expr foobar | ||
VARIABLE: !k/expr foobar|upper | ||
b64_variable: !k/expr foobar|b64encode |
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,2 @@ | ||
encrypted_value: !k/expr encrypted_foobar | ||
unencrypted_value: !k/expr unencrypted_barfoo |
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,10 @@ | ||
variable: !k/expr foobar | ||
VARIABLE: !k/expr foobar|upper | ||
b64_variable: !k/expr foobar|b64encode | ||
--- | ||
json_variable: !k/expr object|to_json | ||
|
||
template: !k/template |- | ||
{{ foobar }} | ||
{{ object.number }} |
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,3 @@ | ||
variable: !k/expr foobar | ||
VARIABLE: !k/expr foobar|upper | ||
b64_variable: !k/expr foobar|b64encode |
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,6 @@ | ||
json_variable: !k/expr object|to_json | ||
|
||
template: !k/template |- | ||
{{ foobar }} | ||
{{ object.number }} |
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,5 @@ | ||
templates: | ||
- templates/basic.yaml | ||
|
||
context: | ||
- vars/_generic.yaml |
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,6 @@ | ||
templates: | ||
- templates/contexts.yaml | ||
|
||
context: | ||
- vars/contexts.yaml | ||
- vars/_generic.yaml |
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,5 @@ | ||
templates: | ||
- templates/dir | ||
|
||
context: | ||
- vars/_generic.yaml |
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,6 @@ | ||
templates: | ||
- templates/dir_and_file/dir | ||
- templates/dir_and_file/two.yaml | ||
|
||
context: | ||
- vars/_generic.yaml |
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,9 @@ | ||
templates: | ||
- templates/encrypted.yaml | ||
|
||
providers: | ||
default: | ||
key_path: .konverter-vault-test | ||
|
||
context: | ||
- vars/_encrypted.yaml |
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,5 @@ | ||
templates: | ||
- templates/multidoc.yaml | ||
|
||
context: | ||
- vars/_generic.yaml |
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,6 @@ | ||
templates: | ||
- templates/multifile/one.yaml | ||
- templates/multifile/two.yaml | ||
|
||
context: | ||
- vars/_generic.yaml |
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,2 @@ | ||
encrypted_foobar: !k/vault gAAAAABeMdtcuKywSJfQo4b0fFDX0PC3ZGoKWGr3cRgl64bjx8taTlV-jAxlcX9AW3x2E5bx5OkYhQbvW8TRUcnxqtefneNirA== | ||
unencrypted_barfoo: !k/encrypt Hello unencryted secret! |
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,5 @@ | ||
foobar: Hello World! | ||
|
||
object: | ||
number: 42 | ||
other: FOOBAR |
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,5 @@ | ||
object: | ||
number: 43 | ||
other: BARFOO | ||
|
||
barfoo: Hello context! |