Merge remote-tracking branch 'origin/master' into feature/copy_to_clipboard
This commit is contained in:
commit
9b65550b71
9 changed files with 23 additions and 15 deletions
|
@ -1,8 +1,13 @@
|
||||||
language: python
|
language: python
|
||||||
python: 2.7
|
python:
|
||||||
|
- "2.6"
|
||||||
|
- "2.7"
|
||||||
|
- "3.3"
|
||||||
|
- "3.4"
|
||||||
|
- "3.5"
|
||||||
sudo: false
|
sudo: false
|
||||||
install:
|
install:
|
||||||
- pip install tox
|
- pip install tox-travis
|
||||||
script:
|
script:
|
||||||
- tox
|
- tox
|
||||||
services:
|
services:
|
||||||
|
|
|
@ -24,12 +24,6 @@ If you are reporting a bug, please include:
|
||||||
as much detail as you can. Questions to start a discussion about the issue
|
as much detail as you can. Questions to start a discussion about the issue
|
||||||
are welcome.
|
are welcome.
|
||||||
|
|
||||||
Python 3.3 Support
|
|
||||||
~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
We'd love for ``tox -e py33`` to work and would welcome anybody who can help
|
|
||||||
make that a reality.
|
|
||||||
|
|
||||||
Fix Bugs
|
Fix Bugs
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
|
@ -119,7 +113,7 @@ Before you submit a pull request, check that it meets these guidelines:
|
||||||
2. If the pull request adds functionality, the docs should be updated. Put
|
2. If the pull request adds functionality, the docs should be updated. Put
|
||||||
your new functionality into a function with a docstring, and add the
|
your new functionality into a function with a docstring, and add the
|
||||||
feature to the list in README.rst.
|
feature to the list in README.rst.
|
||||||
3. The pull request should work for Python 2.7 and ideally 3.3. Check
|
3. The pull request should work for Python 2.6, 2.7 and 3.3+. Check
|
||||||
`Travis`_ and make sure that
|
`Travis`_ and make sure that
|
||||||
the tests pass for all supported Python versions.
|
the tests pass for all supported Python versions.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.3
|
FROM python:3.5
|
||||||
|
|
||||||
ENV APP_DIR=/usr/src/snappass
|
ENV APP_DIR=/usr/src/snappass
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* Redis.
|
* Redis.
|
||||||
* Python 2.6, 2.7 or 3.3.
|
* Python 2.6, 2.7 or 3.3+.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
@ -74,4 +74,4 @@ Alternatively, you can use `Docker`_ and `Docker Compose`_ to install and run Sn
|
||||||
$ docker build -t snappass .
|
$ docker build -t snappass .
|
||||||
$ docker-compose up -d
|
$ docker-compose up -d
|
||||||
|
|
||||||
This will pull all dependencies, i.e. Redis and appropriate Python version (3.3), then start up snappass and Redis server. SnapPass server is accessible at: http://localhost:5000
|
This will pull all dependencies, i.e. Redis and appropriate Python version (3.5), then start up snappass and Redis server. SnapPass server is accessible at: http://localhost:5000
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -30,6 +30,8 @@ setup(
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3.3',
|
'Programming Language :: Python :: 3.3',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Programming Language :: Python :: 3.5',
|
||||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||||
],
|
],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
|
|
|
@ -31,6 +31,8 @@ def set_password(password, ttl):
|
||||||
|
|
||||||
def get_password(key):
|
def get_password(key):
|
||||||
password = redis_client.get(key)
|
password = redis_client.get(key)
|
||||||
|
if password is not None:
|
||||||
|
password = password.decode('utf-8')
|
||||||
redis_client.delete(key)
|
redis_client.delete(key)
|
||||||
return password
|
return password
|
||||||
|
|
||||||
|
|
9
tests.py
9
tests.py
|
@ -23,6 +23,11 @@ class SnapPassTestCase(TestCase):
|
||||||
# Assert that we can't look this up a second time.
|
# Assert that we can't look this up a second time.
|
||||||
self.assertEqual(None, snappass.get_password(key))
|
self.assertEqual(None, snappass.get_password(key))
|
||||||
|
|
||||||
|
def test_password_is_decoded(self):
|
||||||
|
password = "correct horse battery staple"
|
||||||
|
key = snappass.set_password(password, 30)
|
||||||
|
self.assertFalse(isinstance(snappass.get_password(key), bytes))
|
||||||
|
|
||||||
def test_clean_input(self):
|
def test_clean_input(self):
|
||||||
# Test Bad Data
|
# Test Bad Data
|
||||||
with snappass.app.test_request_context(
|
with snappass.app.test_request_context(
|
||||||
|
@ -53,8 +58,8 @@ class SnapPassRoutesTestCase(TestCase):
|
||||||
def test_show_password(self):
|
def test_show_password(self):
|
||||||
password = "I like novelty kitten statues!"
|
password = "I like novelty kitten statues!"
|
||||||
key = snappass.set_password(password, 30)
|
key = snappass.set_password(password, 30)
|
||||||
rv = self.app.get('/{}'.format(key))
|
rv = self.app.get('/{0}'.format(key))
|
||||||
self.assertIn(password, rv.data)
|
self.assertTrue(password in rv.get_data(as_text=True))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -1,5 +1,5 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py27
|
envlist = py26, py27, py33, py34, py35
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
|
|
Loading…
Reference in a new issue