Skip to content

Commit

Permalink
Merge pull request #40 from Scifabric/fix-pbclient
Browse files Browse the repository at this point in the history
Fix pbclient
  • Loading branch information
teleyinex committed Jun 30, 2017
2 parents 5267e31 + 2f25c8d commit 5ad3b00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ def _add_helpingmaterials(config, helping_file, helping_type):
response = config.pbclient.update_helping_material(hm)
check_api_error(response)
else:
response = config.pbclient.create_helping_material(project_id=project.id,
info=helping_info)
response = config.pbclient.create_helpingmaterial(project_id=project.id,
info=helping_info)
check_api_error(response)
# If auto-throttling enabled, sleep for 3 seconds
if sleep: # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="pybossa-pbs",
version="2.4.2",
version="2.4.3",
author="Scifabric LTD",
author_email="info@scifabric.com",
description="PYBOSSA command line client",
Expand Down
12 changes: 6 additions & 6 deletions test/test_pbs_add_helping_materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def test_add_helping_materials_excel_with_info(self, find_mock, workbook_mock):
pbclient = MagicMock()
self.config.pbclient = pbclient
res = _add_helpingmaterials(self.config, helpingmaterials, 'xlsx')
self.config.pbclient.create_helping_material.assert_called_with(project_id=find_mock().id,
info={u'column_name': u'value',
u'foo': u'bar'})
self.config.pbclient.create_helpingmaterial.assert_called_with(project_id=find_mock().id,
info={u'column_name': u'value',
u'foo': u'bar'})
assert res == '8 helping materials added to project: short_name', res

@patch('helpers.find_project_by_short_name')
Expand Down Expand Up @@ -228,7 +228,7 @@ def test_add_helping_materials_csv_connection_error(self, find_mock):
helpingmaterials.read.return_value = "key, value\n, 1, 2"

pbclient = MagicMock()
pbclient.create_helping_material.side_effect = exceptions.ConnectionError
pbclient.create_helpingmaterial.side_effect = exceptions.ConnectionError
self.config.pbclient = pbclient
res = _add_helpingmaterials(self.config, helpingmaterials, 'csv')
assert res == "Connection Error! The server http://server is not responding", res
Expand All @@ -248,7 +248,7 @@ def test_add_helping_material_json_connection_error(self, find_mock):
tasks.read.return_value = json.dumps([{'key': 'value'}])

pbclient = MagicMock()
pbclient.create_helping_material.side_effect = exceptions.ConnectionError
pbclient.create_helpingmaterial.side_effect = exceptions.ConnectionError
self.config.pbclient = pbclient
res = _add_helpingmaterials(self.config, tasks, 'json')
assert res == "Connection Error! The server http://server is not responding", res
Expand All @@ -268,7 +268,7 @@ def test_add_helpingmaterial_another_error(self, find_mock):
tasks.read.return_value = json.dumps([{'key': 'value'}])

pbclient = MagicMock()
pbclient.create_helping_material.return_value = self.error
pbclient.create_helpingmaterial.return_value = self.error
self.config.pbclient = pbclient
assert_raises(ProjectNotFound, _add_helpingmaterials, self.config,
tasks, 'json')
Expand Down

0 comments on commit 5ad3b00

Please sign in to comment.