Skip to content

Commit 42a1ce0

Browse files
committed
Fix imports and tests
1 parent 85078f1 commit 42a1ce0

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

tests/unit/synapseutils/unit_test_synapseutils_copy.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from mock import patch, call
55
from nose.tools import assert_raises, assert_equal
66

7+
import synapseclient
78
import synapseutils
89
from synapseutils.copy_functions import _copy_file_handles_batch, _create_batch_file_handle_copy_request, \
910
_batch_iterator_generator
@@ -291,10 +292,13 @@ def test__batch_iterator_generator__two_iterables(self):
291292
class TestCopyPermissions:
292293
"""Test copy entities with different permissions"""
293294
def setup(self):
294-
self.project_entity = Project(name=str(uuid.uuid4()), id="syn1234")
295-
self.second_project = Project(name=str(uuid.uuid4()), id="syn2345")
296-
self.file_ent = File(name='File', parent=self.project_entity.id,
297-
id="syn3456")
295+
self.project_entity = synapseclient.Project(name=str(uuid.uuid4()),
296+
id="syn1234")
297+
self.second_project = synapseclient.Project(name=str(uuid.uuid4()),
298+
id="syn2345")
299+
self.file_ent = synapseclient.File(name='File',
300+
parent=self.project_entity.id,
301+
id="syn3456")
298302

299303
def test_dont_copy_read_permissions(self):
300304
"""Entities with READ permissions not copied"""
@@ -306,7 +310,7 @@ def test_dont_copy_read_permissions(self):
306310
copied_file = synapseutils.copy(syn, self.file_ent,
307311
destinationId=self.second_project.id,
308312
skipCopyWikiPage=True)
309-
assert_equals(copied_file, dict())
313+
assert_equal(copied_file, dict())
310314
patch_syn_get.assert_called_once_with(self.file_ent,
311315
downloadFile=False)
312316
rest_call = "/entity/{}/permissions".format(self.file_ent.id)
@@ -316,9 +320,12 @@ def test_dont_copy_read_permissions(self):
316320
class TestCopyAccessRestriction:
317321
"""Test that entities with access restrictions aren't copied"""
318322
def setup(self):
319-
self.project_entity = Project(name=str(uuid.uuid4()), id="syn1234")
320-
self.second_project = Project(name=str(uuid.uuid4()), id="syn2345")
321-
self.file_ent = File(name='File', parent=self.project_entity.id)
323+
self.project_entity = synapseclient.Project(name=str(uuid.uuid4()),
324+
id="syn1234")
325+
self.second_project = synapseclient.Project(name=str(uuid.uuid4()),
326+
id="syn2345")
327+
self.file_ent = synapseclient.File(name='File',
328+
parent=self.project_entity.id)
322329
self.file_ent.id = "syn3456"
323330

324331
def test_copy_entity_access_requirements(self):
@@ -333,7 +340,7 @@ def test_copy_entity_access_requirements(self):
333340
copied_file = synapseutils.copy(syn, self.file_ent,
334341
destinationId=self.second_project.id,
335342
skipCopyWikiPage=True)
336-
assert_equals(copied_file, dict())
343+
assert_equal(copied_file, dict())
337344
patch_syn_get.assert_called_once_with(self.file_ent,
338345
downloadFile=False)
339346
calls = [call('/entity/{}/accessRequirement'.format(self.file_ent.id)),
@@ -344,9 +351,12 @@ def test_copy_entity_access_requirements(self):
344351
class TestCopy:
345352
"""Test that certain entities aren't copied"""
346353
def setup(self):
347-
self.project_entity = Project(name=str(uuid.uuid4()), id="syn1234")
348-
self.second_project = Project(name=str(uuid.uuid4()), id="syn2345")
349-
self.file_ent = File(name='File', parent=self.project_entity.id)
354+
self.project_entity = synapseclient.Project(name=str(uuid.uuid4()),
355+
id="syn1234")
356+
self.second_project = synapseclient.Project(name=str(uuid.uuid4()),
357+
id="syn2345")
358+
self.file_ent = synapseclient.File(name='File',
359+
parent=self.project_entity.id)
350360
self.file_ent.id = "syn3456"
351361

352362
def test_no_copy_types(self):
@@ -362,8 +372,8 @@ def test_no_copy_types(self):
362372
copied_file = synapseutils.copy(syn, self.project_entity,
363373
destinationId=self.second_project.id,
364374
skipCopyWikiPage=True)
365-
assert_equals(copied_file, {self.project_entity.id:
366-
self.second_project.id})
375+
assert_equal(copied_file, {self.project_entity.id:
376+
self.second_project.id})
367377
calls = [call(self.project_entity, downloadFile=False),
368378
call(self.second_project.id)]
369379
patch_syn_get.assert_has_calls(calls)

0 commit comments

Comments
 (0)