Skip to content

Commit 02b0958

Browse files
committed
Tweaks Documentation
* Adds separate page that details the CLI config file format. It wasn't appropriate in-line where it was. * Adds coveralls support * Adds badges for pypi downloads and pypi version * Converts README.md to rst format and renames to README.rst. rst is the main format supported on PyPi. * Consolidate unittest2 import logic
1 parent c2a893c commit 02b0958

26 files changed

+97
-128
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ install:
1111
- "if [[ $TRAVIS_PYTHON_VERSION = 2.6 ]]; then pip install unittest2 --use-mirrors; fi"
1212
# command to run tests
1313
script: python setup.py nosetests
14-

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include LICENSE
2-
include README.md
2+
include README.rst

README.md README.rst

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
SoftLayer API Python Client
22
===========================
3-
SoftLayer API bindings for Python. For use with
4-
[SoftLayer's API](http://sldn.softlayer.com/reference/softlayerapi).
53

6-
* [Module Documentation](http://softlayer.github.com/softlayer-api-python-client)
7-
* [API Documentation](http://softlayer.github.com/softlayer-api-python-client/client.html)
8-
* [CLI Documentation](http://softlayer.github.com/softlayer-api-python-client/cli.html)
4+
.. image:: https://badge.fury.io/py/SoftLayer.png
5+
:target: http://badge.fury.io/py/SoftLayer
96

10-
This library provides a simple interface to interact with SoftLayer's XML-RPC
11-
API and provides support for many of SoftLayer API's features like
12-
[object masks](http://sldn.softlayer.com/article/Using-Object-Masks-SoftLayerAPI).
13-
It also contains a command-line interface that can be used to access various
14-
SoftLayer services using the API.
7+
.. image:: https://pypip.in/d/SoftLayer/badge.png
8+
:target: https://crate.io/packages/SoftLayer
159

10+
SoftLayer API bindings for Python. For use with `SoftLayer's API <http://sldn.softlayer.com/reference/softlayerapi>`_.
11+
12+
This library provides a simple interface to interact with SoftLayer's XML-RPC API and provides support for many of SoftLayer API's features like `object masks <http://sldn.softlayer.com/article/Using-Object-Masks-SoftLayerAPI>`_ and a command-line interface that can be used to access various SoftLayer services using the API.
13+
14+
Documentation
15+
-------------
16+
Documentation is available at http://softlayer.github.com/softlayer-api-python-client
17+
1618
Installation
1719
------------
1820
Install via pip:
19-
```
20-
pip install softlayer
21-
```
21+
22+
.. code-block:: bash
23+
24+
$ pip install softlayer
25+
2226
2327
Or you can install from source. Download source and run:
2428

25-
```
26-
python setup.py install
27-
```
29+
.. code-block:: bash
30+
31+
$ python setup.py install
2832
2933
3034
The most up to date version of this library can be found on the SoftLayer
@@ -43,5 +47,5 @@ System Requirements
4347

4448
Copyright
4549
---------
46-
This software is Copyright (c) 2013 [SoftLayer Technologies, Inc](http://www.softlayer.com/).
50+
This software is Copyright (c) 2013 SoftLayer Technologies, Inc.
4751
See the bundled LICENSE file for more information.

SoftLayer/CLI/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def main(args=sys.argv[1:], env=Environment()):
175175
if s:
176176
env.out(s)
177177

178-
except InvalidCommand, e:
178+
except InvalidCommand as e:
179179
env.err(resolver.get_module_help(e.module_name))
180180
if e.command_name:
181181
env.err('')

SoftLayer/tests/CLI/core_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
:copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
66
:license: BSD, see LICENSE for more details.
77
"""
8-
try:
9-
import unittest2 as unittest
10-
except ImportError:
11-
import unittest # NOQA
128
from mock import MagicMock, patch
139

1410
import SoftLayer
1511
import SoftLayer.CLI as cli
12+
from SoftLayer.tests import unittest
1613
from SoftLayer.CLI.helpers import CLIAbort
1714
from SoftLayer.CLI.environment import Environment, InvalidModule
1815

SoftLayer/tests/CLI/environment_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
"""
88
import sys
99
import os
10-
try:
11-
import unittest2 as unittest
12-
except ImportError:
13-
import unittest # NOQA
1410
from mock import patch, MagicMock
1511

1612
from SoftLayer import API_PUBLIC_ENDPOINT
13+
from SoftLayer.tests import unittest
1714
from SoftLayer.CLI.environment import Environment, InvalidCommand
1815

1916
if sys.version_info >= (3,):

SoftLayer/tests/CLI/helper_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
import sys
99
import os
1010
import json
11-
try:
12-
import unittest2 as unittest
13-
except ImportError:
14-
import unittest # NOQA
1511
from mock import patch
1612

1713
import SoftLayer.CLI as cli
14+
from SoftLayer.tests import unittest
1815

1916
if sys.version_info >= (3,):
2017
raw_input_path = 'builtins.input'

SoftLayer/tests/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
try:
3+
import unittest2 as unittest
4+
except ImportError:
5+
import unittest # NOQA

SoftLayer/tests/api_tests.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
:copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
66
:license: BSD, see LICENSE for more details.
77
"""
8-
try:
9-
import unittest2 as unittest
10-
except ImportError:
11-
import unittest # NOQA
12-
138
from mock import patch, call
149

1510
import SoftLayer
1611
import SoftLayer.API
12+
from SoftLayer.tests import unittest
1713
from SoftLayer.consts import USER_AGENT
1814

1915

SoftLayer/tests/auth_tests.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
:copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
66
:license: BSD, see LICENSE for more details.
77
"""
8-
try:
9-
import unittest2 as unittest
10-
except ImportError:
11-
import unittest # NOQA
12-
138
from SoftLayer.auth import (
149
AuthenticationBase, BasicAuthentication, TokenAuthentication)
10+
from SoftLayer.tests import unittest
1511

1612

1713
class TestAuthenticationBase(unittest.TestCase):

SoftLayer/tests/basic_tests.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
:copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
77
:license: BSD, see LICENSE for more details.
88
"""
9-
try:
10-
import unittest2 as unittest
11-
except ImportError:
12-
import unittest # NOQA
13-
149
import SoftLayer
10+
from SoftLayer.tests import unittest
1511

1612

1713
class TestExceptions(unittest.TestCase):

SoftLayer/tests/functional_tests.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
:copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
66
:license: BSD, see LICENSE for more details.
77
"""
8-
import SoftLayer
98
import os
109

11-
try:
12-
import unittest2 as unittest
13-
except ImportError:
14-
import unittest # NOQA
10+
import SoftLayer
11+
from SoftLayer.tests import unittest
1512

1613

1714
def get_creds():
@@ -47,7 +44,7 @@ def test_404(self):
4744
self.assertEqual(e.faultCode, 404)
4845
self.assertIn('NOT FOUND', e.faultString)
4946
self.assertIn('NOT FOUND', e.reason)
50-
except:
47+
else:
5148
self.fail('No Exception Raised')
5249

5350
def test_no_hostname(self):
@@ -59,7 +56,7 @@ def test_no_hostname(self):
5956
self.assertEqual(e.faultCode, 0)
6057
self.assertIn('not known', e.faultString)
6158
self.assertIn('not known', e.reason)
62-
except:
59+
else:
6360
self.fail('No Exception Raised')
6461

6562

@@ -78,7 +75,7 @@ def test_service_does_not_exist(self):
7875
self.assertEqual(e.faultCode, '-32601')
7976
self.assertEqual(e.faultString, 'Service does not exist')
8077
self.assertEqual(e.reason, 'Service does not exist')
81-
except:
78+
else:
8279
self.fail('No Exception Raised')
8380

8481
def test_dns(self):

SoftLayer/tests/managers/cci_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
:license: BSD, see LICENSE for more details.
77
"""
88
from SoftLayer import CCIManager
9+
from SoftLayer.tests import unittest
910

10-
try:
11-
import unittest2 as unittest
12-
except ImportError:
13-
import unittest # NOQA
1411
from mock import MagicMock, ANY, call, patch
1512

1613

SoftLayer/tests/managers/dns_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
:license: BSD, see LICENSE for more details.
77
"""
88
from SoftLayer import DNSManager, DNSZoneNotFound
9+
from SoftLayer.tests import unittest
910

10-
try:
11-
import unittest2 as unittest
12-
except ImportError:
13-
import unittest # NOQA
1411
from mock import MagicMock, ANY
1512

1613

SoftLayer/tests/managers/firewall_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
:license: BSD, see LICENSE for more details.
77
"""
88
from SoftLayer import FirewallManager
9+
from SoftLayer.tests import unittest
910

10-
try:
11-
import unittest2 as unittest
12-
except ImportError:
13-
import unittest # NOQA
1411
from mock import MagicMock, ANY
1512

1613

SoftLayer/tests/managers/hardware_tests.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
"""
88
from SoftLayer import HardwareManager
99
from SoftLayer.managers.hardware import get_default_value
10+
from SoftLayer.tests import unittest
1011

11-
try:
12-
import unittest2 as unittest
13-
except ImportError:
14-
import unittest # NOQA
1512
from mock import MagicMock, ANY, call, patch
1613

1714

@@ -367,4 +364,3 @@ def _setup_package_mocks(self, package_id):
367364
'packageId': package_id,
368365
}],
369366
}]
370-

SoftLayer/tests/managers/metadata_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
"""
88
from SoftLayer import MetadataManager, SoftLayerError, SoftLayerAPIError
99
from SoftLayer.consts import API_PRIVATE_ENDPOINT_REST
10+
from SoftLayer.tests import unittest
1011

11-
try:
12-
import unittest2 as unittest
13-
except ImportError:
14-
import unittest # NOQA
1512
from mock import patch, MagicMock
1613

1714

SoftLayer/tests/managers/network_tests.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
:license: BSD, see LICENSE for more details.
77
"""
88
from SoftLayer import NetworkManager
9+
from SoftLayer.tests import unittest
910

10-
try:
11-
import unittest2 as unittest
12-
except ImportError:
13-
import unittest # NOQA
14-
from mock import MagicMock, ANY, call, patch
11+
from mock import MagicMock, ANY, call
1512

1613

1714
class NetworkTests(unittest.TestCase):

SoftLayer/tests/managers/queue_tests.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@
88
from SoftLayer import MessagingManager, Unauthenticated
99
import SoftLayer.managers.messaging
1010
from SoftLayer.consts import USER_AGENT
11+
from SoftLayer.tests import unittest
1112

1213
import json
13-
try:
14-
import unittest2 as unittest
15-
except ImportError:
16-
import unittest # NOQA
1714
from mock import MagicMock, patch, ANY
1815

1916
QUEUE_1 = {
@@ -45,7 +42,6 @@
4542
SUBSCRIPTION_LIST = {'item_count': 1, 'items': [SUBSCRIPTION_1]}
4643

4744

48-
4945
def mocked_auth_call(self):
5046
self.auth_token = 'NEW_AUTH_TOKEN'
5147

@@ -117,7 +113,6 @@ def test_call_unauthed(self):
117113
self.assertEqual(request.headers, {'X-Auth-Token': 'NEW_AUTH_TOKEN'})
118114

119115

120-
121116
class MessagingManagerTests(unittest.TestCase):
122117

123118
def setUp(self):
@@ -224,7 +219,7 @@ def test_authenticate(self, auth):
224219
@patch('SoftLayer.managers.messaging.MessagingConnection._make_request')
225220
def test_stats(self, make_request):
226221
content = {
227-
'notifications': [{'key': [2012, 7, 27, 14, 31], 'value': 2}],
222+
'notifications': [{'key': [2012, 7, 27, 14, 31], 'value': 2}],
228223
'requests': [{'key': [2012, 7, 27, 14, 31], 'value': 11}]}
229224
make_request().content = json.dumps(content)
230225
result = self.conn.stats()

SoftLayer/tests/managers/ssl_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
:license: BSD, see LICENSE for more details.
77
"""
88
from SoftLayer import SSLManager
9+
from SoftLayer.tests import unittest
910

10-
try:
11-
import unittest2 as unittest
12-
except ImportError:
13-
import unittest # NOQA
1411
from mock import MagicMock, ANY
1512

1613

SoftLayer/tests/transport_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
:copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
66
:license: BSD, see LICENSE for more details.
77
"""
8-
try:
9-
import unittest2 as unittest
10-
except ImportError:
11-
import unittest # NOQA
128
from mock import patch, MagicMock
139

1410
from SoftLayer import SoftLayerAPIError, TransportError
1511
from SoftLayer.transport import make_rest_api_call, make_xml_rpc_api_call
12+
from SoftLayer.tests import unittest
1613
from requests import HTTPError, RequestException
1714

1815

0 commit comments

Comments
 (0)