Skip to content

Commit

Permalink
Ensure that base64 lookup codec encodes the bytes object as a string (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
acmcelwee authored and russellballestrini committed Aug 15, 2019
1 parent 3c14aa4 commit 8278add
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Upcoming release

- Ensure that base64 lookup codec encodes the bytes object as a string [GH-742]

## 1.7.0 (2019-04-07)

- Additional ECS unit tests [GH-696]
Expand Down
2 changes: 1 addition & 1 deletion stacker/lookups/handlers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def json_codec(raw, parameterized=False):

CODECS = {
"plain": lambda x: x,
"base64": lambda x: base64.b64encode(x.encode('utf8')),
"base64": lambda x: base64.b64encode(x.encode('utf8')).decode('utf-8'),
"parameterized": lambda x: parameterized_codec(x, False),
"parameterized-b64": lambda x: parameterized_codec(x, True),
"yaml": lambda x: yaml_codec(x, parameterized=False),
Expand Down
2 changes: 1 addition & 1 deletion stacker/tests/lookups/handlers/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_handler_plain(self, _):
@mock.patch('stacker.lookups.handlers.file.read_value_from_path')
def test_handler_b64(self, content_mock):
plain = u'Hello, world'
encoded = base64.b64encode(plain.encode('utf8'))
encoded = base64.b64encode(plain.encode('utf8')).decode('utf-8')

content_mock.return_value = plain
out = FileLookup.handle(u'base64:file://tmp/test')
Expand Down

0 comments on commit 8278add

Please sign in to comment.