Skip to content

Commit

Permalink
Fix and improve unit tests and add a launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
victorbartel authored and ClementHector committed Feb 7, 2022
1 parent 389cee6 commit 77ae661
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 11 deletions.
34 changes: 34 additions & 0 deletions openpype/modules/shotgrid/tests/shotgrid/lib/test_credentials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import pytest
from assertpy import assert_that

import openpype.modules.shotgrid.lib.credentials as sut


def test_missing_shotgrid_url():
with pytest.raises(Exception) as ex:
# arrange
url = ""
# act
sut.get_shotgrid_hostname(url)
# assert
assert_that(ex).is_equal_to("Shotgrid url cannot be a null")


def test_full_shotgrid_url():
# arrange
url = "https://shotgrid.com/myinstance"
# act
actual = sut.get_shotgrid_hostname(url)
# assert
assert_that(actual).is_not_empty()
assert_that(actual).is_equal_to("shotgrid.com")


def test_incomplete_shotgrid_url():
# arrange
url = "shotgrid.com/myinstance"
# act
actual = sut.get_shotgrid_hostname(url)
# assert
assert_that(actual).is_not_empty()
assert_that(actual).is_equal_to("shotgrid.com")
11 changes: 0 additions & 11 deletions openpype/tests/modules/shotgrid/lib/credentials_test.py

This file was deleted.

3 changes: 3 additions & 0 deletions tools/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export OPENPYPE_DATABASE_NAME=test;
export PYTHONPATH="./;./repos/avalon-core;$PYTHONPATH";
pytest openpype/modules/shotgrid --capture=sys --print -W ignore::DeprecationWarning

0 comments on commit 77ae661

Please sign in to comment.