Skip to content

Commit

Permalink
Bugfix.
Browse files Browse the repository at this point in the history
  • Loading branch information
huntzhan committed Aug 13, 2016
1 parent 0ce30fb commit bba31da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion img2url/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
API_TEMPLATE = 'https://api.github.com{0}'


# return: (filename, base64 encoded, sha)
# return: (filename, base64 encoded bytes, sha)
def load_file(path):
with open(path, 'rb') as fin:
data = fin.read()
Expand All @@ -25,6 +25,7 @@ def load_file(path):

def generate_apienv(path, config):
filename, content, sha = load_file(path)
content = content.decode('ascii')

apienv = {
'filename': filename,
Expand Down
7 changes: 5 additions & 2 deletions tests/test_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ def tmpfile(content, _disable_gc=[]):
return f.name


_b64token = 'OTBkZGE1MGQyZjBjNTViMGFhYzIwMzE1YmEwYjU2ZmZhMGEyMWY4Mw=='
def token():
_b64token = 'OTBkZGE1MGQyZjBjNTViMGFhYzIwMzE1YmEwYjU2ZmZhMGEyMWY4Mw=='
t = base64.b64decode(_b64token)
return t.decode('ascii')


CONFIG_PATH = tmpfile('''
token: {0}
user: img2url-testing
repo: img2url-testing-travisci
'''.format(base64.b64decode(_b64token)))
'''.format(token()))


def test_config():
Expand Down

0 comments on commit bba31da

Please sign in to comment.