2019-08-01 11:06:32 +00:00
|
|
|
import hashlib
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def leaf():
|
2019-08-01 15:21:28 +00:00
|
|
|
def _leaf(node, roots=None):
|
|
|
|
return hashlib.sha256(node.data).hexdigest()
|
2019-08-01 11:06:32 +00:00
|
|
|
|
|
|
|
return _leaf
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def parent():
|
2019-08-01 15:21:28 +00:00
|
|
|
def _parent(first, second):
|
2019-08-01 11:06:32 +00:00
|
|
|
sha256 = hashlib.sha256()
|
2019-08-01 15:21:28 +00:00
|
|
|
sha256.update(first.data)
|
|
|
|
sha256.update(second.data)
|
2019-08-01 11:06:32 +00:00
|
|
|
return sha256.hexdigest()
|
|
|
|
|
|
|
|
return _parent
|