Test: detected commit

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
Václav Valíček 2022-08-04 11:47:07 +02:00
parent 02f092bfc3
commit 41108533c9
Signed by: valicek
GPG Key ID: FF05BDCA0C73BB31

View File

@ -0,0 +1,57 @@
import pytest
from repo_cloner.lib import DetectedCommit
@pytest.fixture
def det_dict():
return {
'commit': "aa5056610ff57f73bae9633a985c6a8e41f3bc23",
'abbrev': "aa50566",
'author': "Mocked Tester",
'date': 1659604838,
'is_tag': True,
'tags': ["tag1", "tag2"],
'is_branch': True,
'branches': ["br1", "br2"],
'log': "Test message\n\nLine 2",
}
@pytest.fixture
def det(det_dict):
return DetectedCommit(det_dict)
def test_detected_commit_dict(det_dict):
det = DetectedCommit(det_dict)
assert det.dict == det_dict
def test_commit(det):
assert det.commit == "aa5056610ff57f73bae9633a985c6a8e41f3bc23"
def test_abbrev(det):
assert det.abbrev == "aa50566"
def test_author(det):
assert det.author == "Mocked Tester"
def test_date(det):
assert det.date == "04-08-2022, 11:20:38"
def test_tags(det):
assert det.is_tag
assert det.tags == "tag1, tag2"
def test_branches(det):
assert det.is_branch
assert det.branches == "br1, br2"
def test_log(det):
assert det.log == "Test message\n\nLine 2"