Skip to content

Commit

Permalink
added ordereddict dependency that is required for py26 compatibility
Browse files Browse the repository at this point in the history
improved the random password complexity to avoid falure from server side.
  • Loading branch information
ssbarnea committed Jan 19, 2015
1 parent 21e4fd4 commit ee96af6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
7 changes: 5 additions & 2 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@ def _try_magic(self):
self._magic = None
except AttributeError:
self._magic = None

def _get_mime_type(self, buff):
if self._magic is not None:
return self._magic.id_buffer(buff)
Expand Down Expand Up @@ -2110,7 +2110,10 @@ def add_user(self, username, email, directoryId=1, password=None, fullname=None,

# implementation based on
# https://docs.atlassian.com/jira/REST/ondemand/#d2e5173
from collections import OrderedDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict

x = OrderedDict()

Expand Down
1 change: 1 addition & 0 deletions requirements-opt.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ipython>=0.13
pytest-cache
unittest2
ordereddict
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ six>=1.9.0
filemagic>=1.6
setuptools>=0.8.0
requests_toolbelt
ordereddict
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ upload-dir = docs/build/html
norecursedirs = . .svn jira _build tmp* lib/third lib *.egg bin distutils build docs demo
python_files = *.py
addopts = -p no:xdist --ignore=setup.py --tb=long -rsxX -v --maxfail=10 --pep8 tests
# --junitxml=reports
# -n 1
# --maxfail=2 -n4
# -n4 runs up to 4 parallel procs
# --maxfail=2 fail fast, dude
Expand Down
31 changes: 21 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/usr/bin/env python
import logging
import os
import sys
from setuptools import setup, find_packages
import warnings

from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
from setuptools import Command

NAME = "jira"
#exec(open('%s/version.py' % NAME).read())
from jira import __version__

import warnings
import logging


# this should help getting annoying warnings from inside distutils
warnings.simplefilter('ignore', UserWarning)

class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]

Expand Down Expand Up @@ -101,13 +103,14 @@ def run(self):
cmdclass={'test': PyTest, 'release': Release},
packages=find_packages(exclude=['tests', 'tools']),
include_package_data=True,
# test_suite='nose.collector',


install_requires=['requests>=1.2.3',
'requests_oauthlib>=0.3.3',
'tlslite>=0.4.4',
'six>=1.5.2',
'requests_toolbelt'],
'requests_toolbelt',
'ordereddict'],
setup_requires=[],
tests_require=['pytest', 'tlslite>=0.4.4', 'requests>=2.0',
'setuptools', 'pep8', 'autopep8', 'sphinx', 'six>=1.9.0'],
Expand All @@ -120,22 +123,30 @@ def run(self):
['jirashell = jira.jirashell:main'],
},

url='https://github.com/pycontribs/jira',
license='BSD',
description='Python library for interacting with JIRA via REST APIs.',
long_description=open("README.rst").read(),
author='Ben Speakmon',
author_email='ben.speakmon@gmail.com',
provides=[NAME],
keywords='jira atlassian rest api',
url='https://github.com/pycontribs/jira',
bugtrack_url='https://github.com/pycontribs/jira/issues',
home_page='https://github.com/pycontribs/jira',
keywords='jira atlassian rest api',

classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Development Status :: 4 - Beta',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
Expand Down
11 changes: 10 additions & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ def rndstr():
return ''.join(random.sample(string.ascii_letters, 6))


def rndpassword():
# generates a password of lengh 14
s = ''.join(random.sample(string.ascii_uppercase, 5)) +\
''.join(random.sample(string.ascii_lowercase, 5)) +\
''.join(random.sample(string.digits, 2)) +\
''.join(random.sample('~`!@#$%^&*()_+-=[]\\{}|;\':<>?,./', 2))
return ''.join(random.sample(s, len(s)))


class Singleton(type):

def __init__(cls, name, bases, dict):
Expand Down Expand Up @@ -1778,7 +1787,7 @@ def setUp(self):
self.jira = JiraTestManager().jira_admin
self.test_username = "test_%s" % JiraTestManager().project_a
self.test_email = "%s@example.com" % self.test_username
self.test_password = rndstr() + '$aZ5'
self.test_password = rndpassword()

def test_add_user(self):

Expand Down

0 comments on commit ee96af6

Please sign in to comment.