Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
remove python 3 build and test targets for short term, adds tox to ma…
Browse files Browse the repository at this point in the history
…ke clean
  • Loading branch information
BradMclain committed Sep 19, 2016
1 parent 525a1f4 commit 33f12ec
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python
python:
- "2.7"
- "3.5"
- "pypy"
install:
- pip install -U coveralls
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ clean:
if [ -a build ]; then rm -rf build; fi;
if [ -a dist ]; then rm -rf dist; fi;
if [ -a build ]; then rm -rf build; fi;
if [ -a .tox ]; then rm -rf .tox; fi;
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*.egg' -exec rm -f {} +
Expand Down
5 changes: 4 additions & 1 deletion tests/test_ciper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
import pytest


@pytest.fixture
def cipher():
from vishnu.cipher import AESCipher
Expand All @@ -16,6 +18,7 @@ def test_pad_unpad():
assert len(padded_data) % AES.block_size == 0
unpadded_data = AESCipher.unpad(padded_data)
assert len(data_to_pad) == len(unpadded_data)
assert data_to_pad == unpadded_data


def test_encrypt_decrypt(cipher):
Expand All @@ -24,4 +27,4 @@ def test_encrypt_decrypt(cipher):
encrypted = cipher.encrypt(data_to_encrypt)
decrypted = cipher.decrypt(encrypted)

assert data_to_encrypt == decrypted
assert data_to_encrypt == decrypted
16 changes: 9 additions & 7 deletions tests/test_session.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import pytest

@pytest.fixture
def session():
def test_cookie_name():
assert True
# from vishnu.session import Session
return None


def test_cookie_name(session):
assert True
# from vishnu.session import DEFAULT_COOKIE_NAME
# default_session = Session()
# assert default_session.cookie_name == DEFAULT_COOKIE_NAME
#
# cookie_name = "my_cookie_name"
# custom_session = Session()
# assert custom_session.cookie_name == cookie_name
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = {py27},{py35}
envlist = {py27}

[testenv]
deps = pytest
Expand Down
2 changes: 1 addition & 1 deletion vishnu/cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AESCipher(object):
"""Helper class for using AES encryption."""

def __init__(self, key):
self._key = hashlib.sha256(key).digest()
self._key = hashlib.sha256(key.encode('utf-8')).digest()

@classmethod
def pad(cls, data):
Expand Down
4 changes: 4 additions & 0 deletions vishnu/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def __init__(self): # pylint: disable=R0912, R0915
# attempt to load an existing cookie
self._load_cookie()

@property
def cookie_name(self):
return self._cookie_name

@property
def started(self):
"""
Expand Down

0 comments on commit 33f12ec

Please sign in to comment.