test(branch): get and list queries

This commit is contained in:
izzy lyseggen
2021-01-21 09:15:24 +00:00
parent 35a121abd9
commit 64434cd7f5
+26 -1
View File
@@ -1,4 +1,4 @@
from speckle.api.models import Branch, Stream
from speckle.api.models import Branch, Commit, Stream
import pytest
@@ -25,3 +25,28 @@ class TestBranch:
)
assert isinstance(branch.id, str)
def test_branch_get(self, client, mesh, stream, branch):
client.commit.create(
stream_id=stream.id,
branch_name=branch.name,
object_id=mesh.id,
message="a commit for testing branch get",
)
fetched_branch = client.branch.get(stream_id=stream.id, name=branch.name)
assert isinstance(fetched_branch, Branch)
assert fetched_branch.name == branch.name
assert fetched_branch.description == branch.description
assert isinstance(fetched_branch.commits.items, list)
assert isinstance(fetched_branch.commits.items[0], Commit)
def test_branch_list(self, client, stream, branch):
branches = client.branch.list(stream_id=stream.id)
print(branches)
assert isinstance(branches, list)
assert len(branches) == 2
assert isinstance(branches[0], Branch)
assert branches[0].name == branch.name