Skip to content

Commit

Permalink
uuid for names instead of static
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble authored Oct 30, 2023
1 parent a538c59 commit a5a9a2b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/integration/synapseclient/integration_test_Entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_Entity(syn: Synapse, project: Project, schedule_for_cleanup):
a_file = syn.get(a_file)
assert filecmp.cmp(path, a_file.path)

b_file = File(name="blah", parent=folder, dataFileHandleId=a_file.dataFileHandleId)
b_file = File(name="blah" + str(uuid.uuid4()), parent=folder, dataFileHandleId=a_file.dataFileHandleId)
b_file = syn.store(b_file)

assert b_file.dataFileHandleId == a_file.dataFileHandleId
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_store_with_flags(syn: Synapse, project: Project, schedule_for_cleanup):
# Store a File
filepath = utils.make_bogus_binary_file()
schedule_for_cleanup(filepath)
origBogus = File(filepath, name="Bogus Test File", parent=project)
origBogus = File(filepath, name="Bogus Test File" + str(uuid.uuid4()), parent=project)
origBogus = syn.store(origBogus, createOrUpdate=True)
assert origBogus.versionNumber == 1

Expand Down Expand Up @@ -259,7 +259,7 @@ def test_store_with_flags(syn: Synapse, project: Project, schedule_for_cleanup):
# This should be ignored because contents (and md5) are different
different_filepath = utils.make_bogus_binary_file()
schedule_for_cleanup(different_filepath)
mutaBogus = File(different_filepath, name="Bogus Test File", parent=project)
mutaBogus = File(different_filepath, name="Bogus Test File" + str(uuid.uuid4()), parent=project)
mutaBogus = syn.store(mutaBogus, forceVersion=False)
assert mutaBogus.versionNumber == 3

Expand All @@ -284,7 +284,7 @@ def test_store_with_flags(syn: Synapse, project: Project, schedule_for_cleanup):
# Expected behavior is raising an exception with a 409 error
newer_filepath = utils.make_bogus_binary_file()
schedule_for_cleanup(newer_filepath)
badBogus = File(newer_filepath, name="Bogus Test File", parent=project)
badBogus = File(newer_filepath, name="Bogus Test File" + str(uuid.uuid4()), parent=project)
pytest.raises(SynapseHTTPError, syn.store, badBogus, createOrUpdate=False)

# -- Storing after syn.get(..., downloadFile=False) --
Expand All @@ -303,7 +303,7 @@ def test_get_with_downloadLocation_and_ifcollision(
):
# Store a File and delete it locally
filepath = utils.make_bogus_binary_file()
bogus = File(filepath, name="Bogus Test File", parent=project)
bogus = File(filepath, name="Bogus Test File" + str(uuid.uuid4()), parent=project)
bogus = syn.store(bogus)
schedule_for_cleanup(bogus)
os.remove(filepath)
Expand Down Expand Up @@ -361,7 +361,7 @@ def test_get_with_cache_hit_and_miss_with_ifcollision(
filepath = utils.make_bogus_binary_file()
original_file_md5 = utils.md5_for_file(filepath).hexdigest()
bogus_file = File(
filepath, name="a_name_that_will_show_up_in_cache", parent=project
filepath, name="a_name_that_will_show_up_in_cache" + str(uuid.uuid4()), parent=project
)
bogus_file = syn.store(bogus_file)
schedule_for_cleanup(bogus_file)
Expand Down Expand Up @@ -415,9 +415,9 @@ def test_store_activity(syn: Synapse, project: Project, schedule_for_cleanup):
# Create a File and an Activity
path = utils.make_bogus_binary_file()
schedule_for_cleanup(path)
entity = File(path, name="Hinkle horn honking holes", parent=project)
entity = File(path, name="Hinkle horn honking holes" + str(uuid.uuid4()), parent=project)
honking = Activity(
name="Hinkle horn honking",
name="Hinkle horn honking" + str(uuid.uuid4()),
description="Nettlebed Cave is a limestone cave located on the South Island of New Zealand.",
)
honking.used("http://www.flickr.com/photos/bevanbfree/3482259379/")
Expand Down Expand Up @@ -449,7 +449,7 @@ def test_store_activity(syn: Synapse, project: Project, schedule_for_cleanup):
# Store another Entity with the same Activity
entity = File(
"http://en.wikipedia.org/wiki/File:Nettlebed_cave.jpg",
name="Nettlebed Cave",
name="Nettlebed Cave" + str(uuid.uuid4()),
parent=project,
synapseStore=False,
)
Expand All @@ -464,7 +464,7 @@ def test_store_isRestricted_flag(syn: Synapse, project: Project, schedule_for_cl
# Store a file with access requirements
path = utils.make_bogus_binary_file()
schedule_for_cleanup(path)
entity = File(path, name="Secret human data", parent=project)
entity = File(path, name="Secret human data" + str(uuid.uuid4()), parent=project)

# We don't want to spam ACT with test emails
with patch(
Expand Down Expand Up @@ -508,7 +508,7 @@ def test_synapseStore_flag(syn: Synapse, project: Project, schedule_for_cleanup)
# Store a path to a local file
path = utils.make_bogus_data_file()
schedule_for_cleanup(path)
bogus = File(path, name="Totally bogus data", parent=project, synapseStore=False)
bogus = File(path, name="Totally bogus data" + str(uuid.uuid4()), parent=project, synapseStore=False)
bogus = syn.store(bogus)

# Verify the thing can be downloaded as a URL
Expand Down Expand Up @@ -571,7 +571,7 @@ def test_create_or_update_project(syn: Synapse, project: Project, schedule_for_c


def test_download_file_false(syn: Synapse, project: Project, schedule_for_cleanup):
RENAME_SUFFIX = "blah"
RENAME_SUFFIX = "blah" + str(uuid.uuid4())

# Upload a file
filepath = utils.make_bogus_binary_file()
Expand Down Expand Up @@ -683,7 +683,7 @@ def test_store__changing_externalURL_by_changing_path(
syn: Synapse, project: Project, schedule_for_cleanup
):
url = "https://www.synapse.org/Portal/clear.cache.gif"
ext = syn.store(File(url, name="test", parent=project, synapseStore=False))
ext = syn.store(File(url, name="test" + str(uuid.uuid4()), parent=project, synapseStore=False))

# perform a syn.get so the filename changes
ext = syn.get(ext)
Expand Down

0 comments on commit a5a9a2b

Please sign in to comment.