From 410212c17a873bcd8e5d672bc9fcb15a8f227965 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Wed, 10 Jun 2020 15:45:29 -0400 Subject: [PATCH] update tests --- tests/unit/schema/test_claim_from_bytes.py | 2 +- tests/unit/schema/test_models.py | 8 +++--- tests/unit/schema/test_schema_signing.py | 32 +++++++++++----------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/unit/schema/test_claim_from_bytes.py b/tests/unit/schema/test_claim_from_bytes.py index b405300d1..5e399deec 100644 --- a/tests/unit/schema/test_claim_from_bytes.py +++ b/tests/unit/schema/test_claim_from_bytes.py @@ -1,7 +1,7 @@ from unittest import TestCase from binascii import unhexlify -from lbry.schema import Claim +from lbry.schema.claim import Claim class TestOldJSONSchemaCompatibility(TestCase): diff --git a/tests/unit/schema/test_models.py b/tests/unit/schema/test_models.py index a2587d2f3..2ac74b4a8 100644 --- a/tests/unit/schema/test_models.py +++ b/tests/unit/schema/test_models.py @@ -103,19 +103,19 @@ class TestTags(TestCase): def test_normalize_tags(self): claim = Claim() - claim.channel.update(tags=['Anime', 'anime', ' aNiMe', 'maNGA ']) + claim.channel.update(tag=['Anime', 'anime', ' aNiMe', 'maNGA ']) self.assertCountEqual(claim.channel.tags, ['anime', 'manga']) - claim.channel.update(tags=['Juri', 'juRi']) + claim.channel.update(tag=['Juri', 'juRi']) self.assertCountEqual(claim.channel.tags, ['anime', 'manga', 'juri']) - claim.channel.update(tags='Anime') + claim.channel.update(tag='Anime') self.assertCountEqual(claim.channel.tags, ['anime', 'manga', 'juri']) claim.channel.update(clear_tags=True) self.assertEqual(len(claim.channel.tags), 0) - claim.channel.update(tags='Anime') + claim.channel.update(tag='Anime') self.assertEqual(claim.channel.tags, ['anime']) diff --git a/tests/unit/schema/test_schema_signing.py b/tests/unit/schema/test_schema_signing.py index 80b3cb949..ad1bf56a7 100644 --- a/tests/unit/schema/test_schema_signing.py +++ b/tests/unit/schema/test_schema_signing.py @@ -1,16 +1,16 @@ from unittest import TestCase from binascii import unhexlify -from lbry.testcase import get_transaction +from lbry.testcase import get_transaction, AsyncioTestCase from lbry.blockchain.ledger import Ledger from lbry.blockchain.transaction import Transaction, Output from lbry.constants import CENT from lbry.schema.claim import Claim -def get_channel(claim_name='@foo'): +async def get_channel(claim_name='@foo'): channel_txo = Output.pay_claim_name_pubkey_hash(CENT, claim_name, Claim(), b'abc') - channel_txo.generate_channel_private_key() + await channel_txo.generate_channel_private_key() return get_transaction(channel_txo).outputs[0] @@ -19,34 +19,34 @@ def get_stream(claim_name='foo'): return get_transaction(stream_txo).outputs[0] -class TestSigningAndValidatingClaim(TestCase): +class TestSigningAndValidatingClaim(AsyncioTestCase): - def test_successful_create_sign_and_validate(self): - channel = get_channel() + async def test_successful_create_sign_and_validate(self): + channel = await get_channel() stream = get_stream() stream.sign(channel) self.assertTrue(stream.is_signed_by(channel)) - def test_fail_to_validate_on_wrong_channel(self): + async def test_fail_to_validate_on_wrong_channel(self): stream = get_stream() - stream.sign(get_channel()) - self.assertFalse(stream.is_signed_by(get_channel())) + stream.sign(await get_channel()) + self.assertFalse(stream.is_signed_by(await get_channel())) - def test_fail_to_validate_altered_claim(self): - channel = get_channel() + async def test_fail_to_validate_altered_claim(self): + channel = await get_channel() stream = get_stream() stream.sign(channel) self.assertTrue(stream.is_signed_by(channel)) stream.claim.stream.title = 'hello' self.assertFalse(stream.is_signed_by(channel)) - def test_valid_private_key_for_cert(self): - channel = get_channel() + async def test_valid_private_key_for_cert(self): + channel = await get_channel() self.assertTrue(channel.is_channel_private_key(channel.private_key)) - def test_fail_to_load_wrong_private_key_for_cert(self): - channel = get_channel() - self.assertFalse(channel.is_channel_private_key(get_channel().private_key)) + async def test_fail_to_load_wrong_private_key_for_cert(self): + channel = await get_channel() + self.assertFalse(channel.is_channel_private_key((await get_channel()).private_key)) class TestValidatingOldSignatures(TestCase):