Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hdd committed Nov 5, 2020
1 parent e467963 commit 97e604e
Showing 1 changed file with 47 additions and 7 deletions.
54 changes: 47 additions & 7 deletions test/unit/structure/test_get_file_from_string_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,23 @@ def structure():
return ftrack_api.structure.id.IdStructure(prefix='another_path')


def file_compound_extension_component_event(container=None):

def file_compound_extension_no_component_event(component_file=None):

'''
Return file component with compound extension through
**ftrack.api.session.get-file-type-from-string** event.
'''

session = ftrack_api.Session()

entity = session.create_component(
component_file
)

return entity

def file_compound_extension_component_event(component_file=None):

'''
Return file component with compound extension through
Expand All @@ -29,21 +45,45 @@ def file_compound_extension_component_event(container=None):


entity = session.create_component(
'mytest.foo.bar'
component_file
)

return entity



@pytest.mark.parametrize('entity, context, expected', [
(
file_compound_extension_component_event(), {},
'foo.bar'
)
file_compound_extension_component_event('mytest.foo.bar'), {},
'.foo.bar'
),
(
file_compound_extension_component_event('mytest.%4d.foo.bar'), {},
'.foo.bar'
),
(
file_compound_extension_component_event('mytest'), {},
''
),
(
file_compound_extension_no_component_event('mytest.foo.bar'), {},
'.bar'
),
(
file_compound_extension_no_component_event('mytest.%4d.foo.bar'), {},
'.bar'
),
(
file_compound_extension_no_component_event('mytest'), {},
''
),
], ids=[
'file-compound-extension-component',
'file-compound-extension-component-event',
'file-sequence-compound-extension-component-event',
'no-file-compound-extension-component-event',
'file-compound-extension-no-component-event',
'file-sequence-compound-extension-no-component-event',
'no-file-compound-extension-no-component-event'
])
def test_get_resource_identifier(structure, entity, context, expected):
'''Get resource identifier.'''
Expand Down

0 comments on commit 97e604e

Please sign in to comment.