tests (e2e/cli): add a test for Pubsub Signing:
rel 381
This commit is contained in:
parent
d9f5f4c8f8
commit
8cf01c8569
1 changed files with 26 additions and 3 deletions
|
|
@ -16,17 +16,19 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
from sat.plugins.plugin_xep_0277 import NS_ATOM
|
||||
from sat.plugins.plugin_sec_oxps import NS_OXPS
|
||||
from sat.tools.common import uri
|
||||
import sh
|
||||
from sh import li
|
||||
|
||||
import pytest
|
||||
from sat.plugins.plugin_sec_oxps import NS_OXPS
|
||||
from sat.plugins.plugin_xep_0277 import NS_ATOM
|
||||
from sat.tools.common import uri
|
||||
|
||||
|
||||
if os.getenv("LIBERVIA_TEST_ENV_E2E") is None:
|
||||
pytest.skip(
|
||||
|
|
@ -349,3 +351,24 @@ class TestE2EEncryption:
|
|||
assert entry_elt.name == "entry"
|
||||
assert entry_elt.uri == NS_ATOM
|
||||
assert secret_blog in parsed_item.toXml()
|
||||
|
||||
def test_pubsub_signature(self, li_json):
|
||||
"""A pubsub item can be signed, and the signature can be verified"""
|
||||
body = "this message is signed"
|
||||
service="account1@server1.test"
|
||||
node ="blog_signing"
|
||||
item="signed_item"
|
||||
li.blog.set(_in=body, service=service, node=node, item=item, sign=True)
|
||||
attachments = li_json.pubsub.attachments.get(
|
||||
service=service, node=node, item=item
|
||||
)
|
||||
assert len(attachments) == 1
|
||||
attachment = attachments[0]
|
||||
assert attachment["from"] == "account1@server1.test"
|
||||
signature_json = attachment["signature"]
|
||||
sign_data = li_json.pubsub.signature.check(
|
||||
json.dumps(signature_json), service=service, node=node, item=item,
|
||||
)
|
||||
assert sign_data["signer"] == "account1@server1.test"
|
||||
assert sign_data["validated"] == True
|
||||
assert all(t == "undecided" for t in sign_data["trusts"].values())
|
||||
|
|
|
|||
Loading…
Reference in a new issue