Skip to content

For #27732 Fix for the schema_field_create test. #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions tests/test_api_long.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import base
import random

class TestShotgunApiLong(base.LiveTestBase):

Expand Down Expand Up @@ -70,10 +71,21 @@ def test_schema(self):
self.assertTrue(schema, dict)
self.assertTrue(len(schema) > 0)
self.assertTrue("user" in schema)

# An explantion is in order here. the field code that is created in shotgun is based on the human display name
# that is provided , so for example "Money Count" would generate the field code 'sg_monkey_count' . The field
# that is created in this test is retired at the end of the test but when this test is run again against
# the same database ( which happens on our Continous Integration server ) trying to create a new field
# called "Monkey Count" will now fail due to the new Delete Field Forever features we have added to shotgun
# since there will a retired field called sg_monkey_count. The old behavior was to go ahead and create a new
# "Monkey Count" field with a field code with an incremented number of the end like sg_monkey_count_1. The new
# behavior is to raise an error in hopes the user will go into the UI and delete the old retired field forever.

# make a the name of the field somewhat unique
human_field_name = "Monkey " + str(random.getrandbits(24))

properties = { "description" : "How many monkeys were needed" }
new_field_name = self.sg.schema_field_create("Version", "number",
"Monkey Count",
new_field_name = self.sg.schema_field_create("Version", "number", human_field_name,
properties=properties)

properties = {"description" : "How many monkeys turned up"}
Expand Down