diff --git a/tests/test_commit.py b/tests/test_commit.py new file mode 100644 index 0000000..2201aa2 --- /dev/null +++ b/tests/test_commit.py @@ -0,0 +1,44 @@ +from tests.test_stream import stream +from speckle.api.models import Commit +import pytest + + +@pytest.fixture(scope="module") +def commit(): + return Commit(message="a fun little test commit") + + +@pytest.fixture(scope="module") +def updated_commit(): + return Commit(message="a fun little updated commit") + + +@pytest.fixture(scope="module") +def stream_id(client): + return client.stream.create("testing commits") + + +def test_create(client, stream_id, commit): + commit_id = client.commit.create( + stream_id=stream_id, object_id="object123", message=commit.message + ) + commit.id = commit_id + + assert isinstance(commit_id, str) + + +def test_get(client, stream_id, commit): + fetched_commit = client.commit.get(stream_id=stream_id, commit_id=commit.id) + + assert fetched_commit.message == commit.message + + +def test_update(client, stream_id, commit, updated_commit): + updated = client.commit.update( + stream_id=stream_id, commit_id=commit.id, message=updated_commit.message + ) + + fetched_commit = client.commit.get(stream_id=stream_id, commit_id=commit.id) + + assert updated == True + assert fetched_commit.message == updated_commit.message diff --git a/tests/test_objects.py b/tests/test_objects.py new file mode 100644 index 0000000..5871ed8 --- /dev/null +++ b/tests/test_objects.py @@ -0,0 +1 @@ +import pytest