Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
language: python
python:
- "2.7"
- 2.7
- 3.4
- 3.5
install:
- cp config.default.py config.py
- pip install -r requirements.txt
before_script:
- ./pylint-check.py
script:
- mkdir -p ../logs
- py.test -v --cov postmaster --cov-report term-missing tests/
after_success:
- coveralls
Expand Down
1 change: 1 addition & 0 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Features:
Improvements:

* Replaced GIF spinner with a pure CSS spinner using CSS3 animations [GH-177].
* Adds Python 3.5 support [GH-179] [GH-180]

### v1.1.0 - A Hard Day's Night

Expand Down
6 changes: 3 additions & 3 deletions postmaster/apiv1/admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from flask import request
from flask_login import login_required, current_user
import pyqrcode
from StringIO import StringIO
from io import BytesIO
from postmaster import db
from postmaster.models import Admins
from postmaster.logger import json_logger
Expand Down Expand Up @@ -219,9 +219,9 @@ def qrcode(admin_id):
'The following error occurred in qrcode: {0}'.format(str(e)))
raise GenericError('The administrator could not be updated')
url = pyqrcode.create(admin.get_totp_uri())
stream = StringIO()
stream = BytesIO()
url.svg(stream, scale=5)
return stream.getvalue().encode('utf-8'), 200, {
return stream.getvalue(), 200, {
'Content-Type': 'image/svg+xml',
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
Expand Down
2 changes: 1 addition & 1 deletion postmaster/apiv1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ def get_logs_dict(numLines=50, reverseOrder=False):
if reverseOrder:
logs = list(reversed(logs))

return {'items': [loads(log) for log in logs], }
return {'items': [loads(log.decode('utf-8')) for log in logs], }
else:
raise ValidationError('The log file could not be found')
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## PostMaster [![Build Status](https://travis-ci.org/StackFocus/PostMaster.svg?branch=master)](https://travis-ci.org/StackFocus/PostMaster) ![Python](https://img.shields.io/badge/python-2.7-blue.svg) ![Flask](http://flask.pocoo.org/static/badges/made-with-flask-s.png)
## PostMaster [![Build Status](https://travis-ci.org/StackFocus/PostMaster.svg?branch=master)](https://travis-ci.org/StackFocus/PostMaster) ![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg) ![Python 3.5](https://img.shields.io/badge/python-3.5-blue.svg) ![Flask](http://flask.pocoo.org/static/badges/made-with-flask-s.png)

### Overview

Expand Down
12 changes: 6 additions & 6 deletions tests/ad/test_ad_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def test_login_fail(self):
"""
with pytest.raises(postmaster.ad.ADException) as excinfo:
self.ad_obj.login('user', 'WrongPassword')
assert excinfo.value.message == 'The username or password was incorrect'
assert str(excinfo.value) == 'The username or password was incorrect'

@manage_mock_ldap
def test_parse_username_input_with_domain(self):
""" Tests the parse_username_input function when the username input is postmaster\username
r""" Tests the parse_username_input function when the username input is postmaster\username
"""
assert self.ad_obj.parse_username_input('postmaster\\testUser3') == 'postmaster\\testUser3'

Expand Down Expand Up @@ -88,7 +88,7 @@ def test_search_with_attr(self):
assert self.ad_obj.search('(displayName=Test User)', ['name']) == [{
'attributes': {'name': u'Test User'},
'dn': 'CN=Test User,OU=PostMaster,DC=postmaster,DC=local',
'raw_attributes': {'name': ['Test User']},
'raw_attributes': {'name': [b'Test User']},
'type': 'searchResEntry'
}]

Expand Down Expand Up @@ -220,7 +220,7 @@ def test_check_group_membership_pass_primary_group(self):
assert self.ad_obj.login(
'CN=testUser2,OU=PostMaster,DC=postmaster,DC=local', 'P@ssW0rd') is True
with patch('postmaster.ad.AD.check_nested_group_membership', return_value=False):
assert self.ad_obj.check_group_membership() is True
assert self.ad_obj.check_group_membership() is True

@manage_mock_ldap
def test_check_group_membership_fail(self):
Expand All @@ -232,7 +232,7 @@ def test_check_group_membership_fail(self):
with patch('postmaster.ad.AD.check_nested_group_membership', return_value=False):
with pytest.raises(postmaster.ad.ADException) as excinfo:
self.ad_obj.check_group_membership()
assert excinfo.value.message == 'The user account is not authorized to login to PostMaster'
assert str(excinfo.value) == 'The user account is not authorized to login to PostMaster'

@manage_mock_ldap
def test_validate_wtforms_password(self):
Expand All @@ -255,4 +255,4 @@ def test_validate_wtforms_password(self):
follow_redirects=True
)

assert '<h2 class="textHeading">Dashboard</h2>' in rv.data
assert '<h2 class="textHeading">Dashboard</h2>' in rv.data.decode('utf-8')
Loading