Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for running the test suite using nose.

Couldn't find any instructions for running the tests, and ``python
setup.py test`` wasn't working for me.  Nose is a good one to use and
trivial to set up.

Added a requirements file for the testing dependencies (mock was missing)

Updated your README to have some instructions for potential
contributors.  You want it to be as easy as possible to go from zero to
all tests passing.
  • Loading branch information...
commit ae7cab3d8268b29ffcc97148667b32c8af17f4b5 1 parent 02ba68f
@codeinthehole codeinthehole authored
View
18 README.rst
@@ -37,3 +37,21 @@ active resource style API. For example, to get all of a merchants bills::
>>> merchant.bills()
>>> [<gocardless.resources.Bill at 0x29a6050>]
+Contribute
+==========
+
+Fork the repo then clone it to your machine and install in "develop" mode
+(preferably using a virtualenv)::
+
+ mkvirtualenv gocardless
+ git clone https://github.com/<username>/gocardless-python
+ cd gocardless-python
+ python setup.py develop
+
+Install the testing dependencies::
+
+ pip install -r requirements.txt
+
+and run the test suite::
+
+ nosetests
View
2  requirements.txt
@@ -0,0 +1,2 @@
+mock==0.8.0
+nose==1.1.2
View
10 test/test_client.py
@@ -83,10 +83,10 @@ def test_get_merchant(self):
self.assertEqual(merchant.id, self.account_details["merchant_id"])
def test_get_subscription(self):
- self.get_resource_tester("subscription", fixtures.subscription_json)
+ self._get_resource_tester("subscription", fixtures.subscription_json)
def test_get_user(self):
- self.get_resource_tester("user", create_mock_attrs({}))
+ self._get_resource_tester("user", create_mock_attrs({}))
def test_get_pre_authorization(self):
mock_date = datetime.datetime.now().isoformat()[:-7] + "Z"
@@ -95,15 +95,15 @@ def test_get_pre_authorization(self):
"expires_at":mock_date,
"next_interval_start":mock_date
}
- self.get_resource_tester("pre_authorization",
+ self._get_resource_tester("pre_authorization",
create_mock_attrs(mock_attrs))
def test_get_bill(self):
- self.get_resource_tester("bill", create_mock_attrs(
+ self._get_resource_tester("bill", create_mock_attrs(
{"paid_at":datetime.datetime.now().isoformat()[:-7] + "Z",
"user_id":"someuserid"}))
- def get_resource_tester(self, resource_name, resource_fixture):
+ def _get_resource_tester(self, resource_name, resource_fixture):
expected_klass = getattr(sys.modules["gocardless.resources"], utils.camelize(resource_name))
with patch.object(self.client, 'api_get'):
self.client.api_get.return_value = resource_fixture
View
4 test/test_params.py
@@ -20,7 +20,7 @@ def test_interval_unit_is_valid(self):
with self.assertRaises(ValueError):
pars = self.create_params(10, 10, "1432233123", "invalid")
- def future_date_tester(self, argname):
+ def _future_date_tester(self, argname):
invalid_date = datetime.datetime.now() - datetime.timedelta(100)
valid_date = datetime.datetime.now() + datetime.timedelta(2000)
par1 = self.create_params(10, 10, "23423421", "day", **{argname:valid_date})
@@ -29,7 +29,7 @@ def future_date_tester(self, argname):
**{argname:invalid_date})
def test_expires_at_in_future(self):
- self.future_date_tester("expires_at")
+ self._future_date_tester("expires_at")
def test_interval_count_positive(self):
with self.assertRaises(ValueError):
Please sign in to comment.
Something went wrong with that request. Please try again.