Extract out stream() method
This commit is contained in:
@@ -4,7 +4,7 @@ from collections import OrderedDict
|
||||
import pytest
|
||||
from nacl.signing import SigningKey, VerifyKey
|
||||
|
||||
from ssb.feed import LocalMessage, LocalFeed, Feed, Message, NoPrivateKeyException
|
||||
from ssb.feed import LocalMessage, LocalFeed, Feed, Message
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@@ -99,3 +99,27 @@ def test_remote_no_signature(remote_feed):
|
||||
('name', 'neo'),
|
||||
('description', 'The Chosen One')
|
||||
]), None, timestamp=1495706260190)
|
||||
|
||||
|
||||
def test_serialize(local_feed):
|
||||
m1 = LocalMessage(local_feed, OrderedDict([
|
||||
('type', 'about'),
|
||||
('about', local_feed.id),
|
||||
('name', 'neo'),
|
||||
('description', 'The Chosen One')
|
||||
]), timestamp=1495706260190)
|
||||
|
||||
assert m1.serialize() == b"""{
|
||||
"previous": null,
|
||||
"author": "@I/4cyN/jPBbDsikbHzAEvmaYlaJK33lW3UhWjNXjyrU=.ed25519",
|
||||
"sequence": 1,
|
||||
"timestamp": 1495706260190,
|
||||
"hash": "sha256",
|
||||
"content": {
|
||||
"type": "about",
|
||||
"about": "@I/4cyN/jPBbDsikbHzAEvmaYlaJK33lW3UhWjNXjyrU=.ed25519",
|
||||
"name": "neo",
|
||||
"description": "The Chosen One"
|
||||
},
|
||||
"signature": "lPsQ9P10OgeyH6u0unFgiI2wV/RQ7Q2x2ebxnXYCzsJ055TBMXphRADTKhOMS2EkUxXQ9k3amj5fnWPudGxwBQ==.sig.ed25519"
|
||||
}"""
|
||||
|
Reference in New Issue
Block a user