Skip to content

Commit

Permalink
Merged in backlog/update-test-server (pull request #282)
Browse files Browse the repository at this point in the history
update testing environment

Approved-by: Björn Rydahl
  • Loading branch information
torsdag committed Oct 3, 2022
2 parents 88b364e + 840a648 commit 53c221e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
3 changes: 2 additions & 1 deletion bitbucket-pipelines.yml
Expand Up @@ -4,14 +4,15 @@ options:
definitions:
services:
ftrack:
memory: 3072
image:
name: ftrackdocker/test-server:latest
username: $DOCKER_HUB_USERNAME
password: $DOCKER_HUB_PASSWORD
email: $DOCKER_HUB_EMAIL
pipelines:
default:
- parallel:
- parallel:
- step:
name: run tests against python 2.7.x
image: python:2.7
Expand Down
7 changes: 7 additions & 0 deletions test/unit/entity/test_asset_version.py
@@ -1,6 +1,9 @@
# :coding: utf-8
# :copyright: Copyright (c) 2015 ftrack
import json
import pytest

import ftrack_api


def test_create_component(new_asset_version, temporary_file):
Expand Down Expand Up @@ -33,6 +36,10 @@ def test_create_component_specifying_different_version(
session.delete(component)


@pytest.mark.xfail(
raises=ftrack_api.exception.ServerError,
reason='Testing environment does not support encoding'
)
def test_encode_media(new_asset_version, video_path):
'''Encode media based on a file path
Expand Down
34 changes: 28 additions & 6 deletions test/unit/test_session.py
Expand Up @@ -216,8 +216,13 @@ def test_ensure_entity_with_non_string_data_types(session, mocker):

def test_ensure_entity_with_identifying_keys(session, unique_name):
'''Ensure entity, checking using keys subset and then creating.'''

unique_mail = 'test{0}@example.com'.format(
str(uuid.uuid4())
)

entity = session.ensure(
'User', {'username': unique_name, 'email': 'test@example.com'},
'User', {'username': unique_name, 'email': unique_mail},
identifying_keys=['username']
)
assert entity['username'] == unique_name
Expand Down Expand Up @@ -250,18 +255,28 @@ def test_ensure_existing_entity(session, unique_name):

def test_ensure_update_existing_entity(session, unique_name):
'''Ensure and update existing entity.'''

mail = 'test{0}@example.com'.format(
str(uuid.uuid4())
)

entity = session.ensure(
'User', {'first_name': unique_name, 'email': 'anon@example.com'}
'User', {'first_name': unique_name, 'email': mail}
)
assert entity['email'] == mail

updated_mail = 'test{0}@example.com'.format(
str(uuid.uuid4())
)
assert entity['email'] == 'anon@example.com'

# Second call should commit updates.
retrieved = session.ensure(
'User', {'first_name': unique_name, 'email': 'test@example.com'},
'User', {'first_name': unique_name, 'email': updated_mail},
identifying_keys=['first_name']
)

assert retrieved == entity
assert retrieved['email'] == 'test@example.com'
assert retrieved['email'] == updated_mail


def test_reconstruct_entity(session):
Expand Down Expand Up @@ -1137,6 +1152,10 @@ def test_get_info_widget_url(session, task):
response.raise_for_status()


@pytest.mark.xfail(
raises=ftrack_api.exception.ServerError,
reason='Testing environment does not support encoding'
)
def test_encode_media_from_path(session, video_path):
'''Encode media based on a file path.'''
job = session.encode_media(video_path)
Expand All @@ -1152,6 +1171,10 @@ def test_encode_media_from_path(session, video_path):
assert 'format' in job_data['output'][0]


@pytest.mark.xfail(
raises=ftrack_api.exception.ServerError,
reason='Testing environment does not support encoding'
)
def test_encode_media_from_component(session, video_path):
'''Encode media based on a component.'''
location = session.query('Location where name is "ftrack.server"').one()
Expand Down Expand Up @@ -1515,4 +1538,3 @@ def test_operation_recoding_thread_dependent(session, propagating_thread):

assert operation.entity_type == 'User'
assert operation.entity_key['id'] == _id

0 comments on commit 53c221e

Please sign in to comment.