Skip to content

Commit

Permalink
global: fix broken imports
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Kuncar <[email protected]>
  • Loading branch information
jirikuncar committed Oct 5, 2015
1 parent db5889f commit baeae28
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'invenio-collections>=0.1.2',
'invenio-ext>=0.2.1',
'invenio-formatter>=0.2.1',
'invenio-pidstore>=0.1.1', # TODO consider making it optional
'invenio-pidstore>=0.1.2',
'invenio-search>=0.1.3',
'invenio-upgrader>=0.1.0',
'invenio-celery>=0.1.0',
Expand Down
12 changes: 6 additions & 6 deletions tests/test_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
class TestProcessor(InvenioTestCase):
"""Test processor."""

@patch('invenio_records.api.Record')
def test_processor_string(self, Record):
@patch('invenio_records.tasks.api.create_record')
def test_processor_string(self, create_record):
"""Processor - try import string."""
from invenio_records.manage import create
self.app.config['RECORD_PROCESSORS'] = {
'marcxml': 'invenio_records.manage:convert_marcxml'
}
create(open(os.path.join(os.path.dirname(__file__),
"data/sample-records.xml")), input_type="marcxml")
self.assertEquals(Record.create.call_count, 2)
self.assertEquals(create_record.s.call_count, 2)

@patch('invenio_records.api.Record')
def test_processor_callable(self, Record):
@patch('invenio_records.tasks.api.create_record')
def test_processor_callable(self, create_record):
"""Processor - try import callable."""
from invenio_records.manage import create
from invenio_records.manage import convert_marcxml
Expand All @@ -48,4 +48,4 @@ def test_processor_callable(self, Record):
}
create(open(os.path.join(os.path.dirname(__file__),
"data/sample-records.xml")), input_type="marcxml")
self.assertEquals(Record.create.call_count, 2)
self.assertEquals(create_record.s.call_count, 2)
9 changes: 4 additions & 5 deletions tests/test_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@

from dojson.contrib.marc21.utils import create_record, split_blob

from invenio_documents.models import Document

from invenio_record.models import Record

from invenio_testing import InvenioTestCase

from mock import patch
Expand All @@ -47,7 +43,7 @@ def test_records_created(self):
xmlpath = os.path.join(os.path.dirname(__file__), 'data',
'demo_record_marc_data.xml')
with open(xmlpath, 'r') as xmltext:
recs = [record for record in split_blob(xmltext)]
recs = [record for record in split_blob(xmltext.read())]
assert len(recs) == 142

def test_accented_unicode_letterst_test(self):
Expand Down Expand Up @@ -93,6 +89,7 @@ class TestLegacyExport(InvenioTestCase):
def test_legacy_export_marcxml(self):
"""Record - legacy export marxml."""
# FIXME: use a better way to compare
from invenio_record.models import Record
from invenio.legacy.bibrecord import create_record, records_identical
blob = '''
<record>
Expand Down Expand Up @@ -121,6 +118,7 @@ def test_legacy_export_marcxml(self):

def test_legacy_create_recstruct(self):
"""Record - create recstruct."""
from invenio_record.models import Record
from invenio.legacy.bibrecord import create_record, records_identical

blob = '''
Expand Down Expand Up @@ -521,6 +519,7 @@ def setUp(self):
def test_restricted_record_non_restricted_document(
self, check_user_can_view_record_patch):
"""Record - Restrcited access to record documents."""
from invenio_documents.models import Document
d = Document.create({'title': 'Document 1',
'description': 'Testing 1',
'restriction': {'email': '[email protected]'},
Expand Down
7 changes: 3 additions & 4 deletions tests/test_tasks_datacite.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ def tearDown(self):
def patch_get_record(self, get_record_patch):
from invenio_records.api import Record
r = Record(
json={
{
self.app.config['PIDSTORE_DATACITE_RECORD_DOI_FIELD']:
'10.1234/invenio.1234',
'recid': 1,
},
master_format='json'
}
)
get_record_patch.return_value = r

@patch('invenio_pidstore.tasks.datacite.get_record')
@patch('invenio_records.tasks.datacite.get_record')
@httpretty.activate
def test_sync_registered(self, get_record_patch):
self.patch_get_record(get_record_patch)
Expand Down

0 comments on commit baeae28

Please sign in to comment.