run sed on tests too
This commit is contained in:
parent
a099e2db6a
commit
a9da6e4bdf
6 changed files with 74 additions and 74 deletions
|
@ -16,17 +16,17 @@ from lbrynet.lbrylive.PaymentRateManager import BaseLiveStreamPaymentRateManager
|
|||
from lbrynet.lbrylive.PaymentRateManager import LiveStreamPaymentRateManager
|
||||
from lbrynet.lbrylive.LiveStreamMetadataManager import DBLiveStreamMetadataManager
|
||||
from lbrynet.lbrylive.LiveStreamMetadataManager import TempLiveStreamMetadataManager
|
||||
from lbrynet.lbryfile.LBRYFileMetadataManager import TempLBRYFileMetadataManager, DBLBRYFileMetadataManager
|
||||
from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager
|
||||
from lbrynet.lbryfile.FileMetadataManager import TempFileMetadataManager, DBFileMetadataManager
|
||||
from lbrynet.lbryfilemanager.FileManager import FileManager
|
||||
from lbrynet.core.PaymentRateManager import PaymentRateManager
|
||||
from lbrynet.core.PTCWallet import PointTraderKeyQueryHandlerFactory, PointTraderKeyExchanger
|
||||
from lbrynet.core.Session import LBRYSession
|
||||
from lbrynet.core.Session import Session
|
||||
from lbrynet.core.client.StandaloneBlobDownloader import StandaloneBlobDownloader
|
||||
from lbrynet.core.StreamDescriptor import BlobStreamDescriptorWriter
|
||||
from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier
|
||||
from lbrynet.core.StreamDescriptor import download_sd_blob
|
||||
from lbrynet.lbryfilemanager.LBRYFileCreator import create_lbry_file
|
||||
from lbrynet.lbryfile.client.LBRYFileOptions import add_lbry_file_to_sd_identifier
|
||||
from lbrynet.lbryfilemanager.FileCreator import create_lbry_file
|
||||
from lbrynet.lbryfile.client.FileOptions import add_lbry_file_to_sd_identifier
|
||||
from lbrynet.lbryfile.StreamDescriptor import get_sd_info
|
||||
from twisted.internet import defer, threads, task, error
|
||||
from twisted.trial.unittest import TestCase
|
||||
|
@ -41,7 +41,7 @@ from lbrynet.lbrylive.server.LiveBlobInfoQueryHandler import CryptBlobInfoQueryH
|
|||
from lbrynet.lbrylive.client.LiveStreamOptions import add_live_stream_to_sd_identifier
|
||||
from lbrynet.lbrylive.client.LiveStreamDownloader import add_full_live_stream_downloader_to_sd_identifier
|
||||
from lbrynet.core.BlobManager import TempBlobManager
|
||||
from lbrynet.reflector.client.client import LBRYFileReflectorClientFactory
|
||||
from lbrynet.reflector.client.client import FileReflectorClientFactory
|
||||
from lbrynet.reflector.server.server import ReflectorServerFactory
|
||||
from lbrynet.lbryfile.StreamDescriptor import publish_sd_blob
|
||||
|
||||
|
@ -232,13 +232,13 @@ def start_lbry_uploader(sd_hash_queue, kill_event, dead_event, file_size, ul_rat
|
|||
db_dir = "server"
|
||||
os.mkdir(db_dir)
|
||||
|
||||
session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer, peer_port=5553,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
stream_info_manager = TempLBRYFileMetadataManager()
|
||||
stream_info_manager = TempFileMetadataManager()
|
||||
|
||||
lbry_file_manager = LBRYFileManager(session, stream_info_manager, sd_identifier)
|
||||
lbry_file_manager = FileManager(session, stream_info_manager, sd_identifier)
|
||||
|
||||
if ul_rate_limit is not None:
|
||||
session.rate_limiter.set_ul_limit(ul_rate_limit)
|
||||
|
@ -349,14 +349,14 @@ def start_lbry_reuploader(sd_hash, kill_event, dead_event, ready_event, n, ul_ra
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd" + str(n),
|
||||
session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd" + str(n),
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=None, peer_port=peer_port,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
stream_info_manager = TempLBRYFileMetadataManager()
|
||||
stream_info_manager = TempFileMetadataManager()
|
||||
|
||||
lbry_file_manager = LBRYFileManager(session, stream_info_manager, sd_identifier)
|
||||
lbry_file_manager = FileManager(session, stream_info_manager, sd_identifier)
|
||||
|
||||
if ul_rate_limit is not None:
|
||||
session.rate_limiter.set_ul_limit(ul_rate_limit)
|
||||
|
@ -463,7 +463,7 @@ def start_live_server(sd_hash_queue, kill_event, dead_event):
|
|||
db_dir = "server"
|
||||
os.mkdir(db_dir)
|
||||
|
||||
session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer, peer_port=5553,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
|
@ -608,7 +608,7 @@ def start_blob_uploader(blob_hash_queue, kill_event, dead_event, slow):
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="efgh",
|
||||
session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="efgh",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=blob_dir, peer_port=peer_port,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
@ -781,14 +781,14 @@ class TestTransfer(TestCase):
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
self.session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=blob_dir, peer_port=5553,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
self.stream_info_manager = TempLBRYFileMetadataManager()
|
||||
self.stream_info_manager = TempFileMetadataManager()
|
||||
|
||||
self.lbry_file_manager = LBRYFileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
self.lbry_file_manager = FileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
|
||||
def make_downloader(metadata, prm):
|
||||
info_validator = metadata.validator
|
||||
|
@ -865,7 +865,7 @@ class TestTransfer(TestCase):
|
|||
db_dir = "client"
|
||||
os.mkdir(db_dir)
|
||||
|
||||
self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
self.session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer, blob_dir=None,
|
||||
peer_port=5553, use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
|
@ -969,7 +969,7 @@ class TestTransfer(TestCase):
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
self.session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=blob_dir, peer_port=5553,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
@ -1049,14 +1049,14 @@ class TestTransfer(TestCase):
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
self.session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=blob_dir, peer_port=5553, use_upnp=False,
|
||||
rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
self.stream_info_manager = DBLBRYFileMetadataManager(self.session.db_dir)
|
||||
self.stream_info_manager = DBFileMetadataManager(self.session.db_dir)
|
||||
|
||||
self.lbry_file_manager = LBRYFileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
self.lbry_file_manager = FileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
|
||||
def make_downloader(metadata, prm):
|
||||
info_validator = metadata.validator
|
||||
|
@ -1165,14 +1165,14 @@ class TestTransfer(TestCase):
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
self.session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=None, peer_port=5553,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
self.stream_info_manager = TempLBRYFileMetadataManager()
|
||||
self.stream_info_manager = TempFileMetadataManager()
|
||||
|
||||
self.lbry_file_manager = LBRYFileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
self.lbry_file_manager = FileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
|
||||
def start_additional_uploaders(sd_hash):
|
||||
for i in range(1, num_uploaders):
|
||||
|
@ -1283,14 +1283,14 @@ class TestStreamify(TestCase):
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
self.session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=blob_dir, peer_port=5553,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
self.stream_info_manager = TempLBRYFileMetadataManager()
|
||||
self.stream_info_manager = TempFileMetadataManager()
|
||||
|
||||
self.lbry_file_manager = LBRYFileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
self.lbry_file_manager = FileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
|
||||
d = self.session.setup()
|
||||
d.addCallback(lambda _: self.stream_info_manager.setup())
|
||||
|
@ -1335,14 +1335,14 @@ class TestStreamify(TestCase):
|
|||
os.mkdir(db_dir)
|
||||
os.mkdir(blob_dir)
|
||||
|
||||
self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
self.session = Session(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid="abcd",
|
||||
peer_finder=peer_finder, hash_announcer=hash_announcer,
|
||||
blob_dir=blob_dir, peer_port=5553,
|
||||
use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)
|
||||
|
||||
self.stream_info_manager = DBLBRYFileMetadataManager(self.session.db_dir)
|
||||
self.stream_info_manager = DBFileMetadataManager(self.session.db_dir)
|
||||
|
||||
self.lbry_file_manager = LBRYFileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
self.lbry_file_manager = FileManager(self.session, self.stream_info_manager, sd_identifier)
|
||||
|
||||
def start_lbry_file(lbry_file):
|
||||
logging.debug("Calling lbry_file.start()")
|
||||
|
|
|
@ -12,10 +12,10 @@ from lbrynet.core import PeerManager
|
|||
from lbrynet.core import RateLimiter
|
||||
from lbrynet.core import Session
|
||||
from lbrynet.core import StreamDescriptor
|
||||
from lbrynet.lbryfile import LBRYFileMetadataManager
|
||||
from lbrynet.lbryfile.client import LBRYFileOptions
|
||||
from lbrynet.lbryfilemanager import LBRYFileCreator
|
||||
from lbrynet.lbryfilemanager import LBRYFileManager
|
||||
from lbrynet.lbryfile import FileMetadataManager
|
||||
from lbrynet.lbryfile.client import FileOptions
|
||||
from lbrynet.lbryfilemanager import FileCreator
|
||||
from lbrynet.lbryfilemanager import FileManager
|
||||
|
||||
from tests import mocks
|
||||
|
||||
|
@ -81,7 +81,7 @@ class TestReflector(unittest.TestCase):
|
|||
db_dir = "client"
|
||||
os.mkdir(db_dir)
|
||||
|
||||
self.session = Session.LBRYSession(
|
||||
self.session = Session.Session(
|
||||
conf.MIN_BLOB_DATA_PAYMENT_RATE,
|
||||
db_dir=db_dir,
|
||||
lbryid="abcd",
|
||||
|
@ -94,16 +94,16 @@ class TestReflector(unittest.TestCase):
|
|||
wallet=wallet
|
||||
)
|
||||
|
||||
self.stream_info_manager = LBRYFileMetadataManager.TempLBRYFileMetadataManager()
|
||||
self.stream_info_manager = FileMetadataManager.TempFileMetadataManager()
|
||||
|
||||
self.lbry_file_manager = LBRYFileManager.LBRYFileManager(
|
||||
self.lbry_file_manager = FileManager.FileManager(
|
||||
self.session, self.stream_info_manager, sd_identifier)
|
||||
|
||||
self.server_blob_manager = BlobManager.TempBlobManager(hash_announcer)
|
||||
|
||||
d = self.session.setup()
|
||||
d.addCallback(lambda _: self.stream_info_manager.setup())
|
||||
d.addCallback(lambda _: LBRYFileOptions.add_lbry_file_to_sd_identifier(sd_identifier))
|
||||
d.addCallback(lambda _: FileOptions.add_lbry_file_to_sd_identifier(sd_identifier))
|
||||
d.addCallback(lambda _: self.lbry_file_manager.setup())
|
||||
d.addCallback(lambda _: self.server_blob_manager.setup())
|
||||
|
||||
|
@ -128,7 +128,7 @@ class TestReflector(unittest.TestCase):
|
|||
|
||||
def create_stream():
|
||||
test_file = mocks.GenFile(5209343, b''.join([chr(i + 3) for i in xrange(0, 64, 6)]))
|
||||
d = LBRYFileCreator.create_lbry_file(
|
||||
d = FileCreator.create_lbry_file(
|
||||
self.session,
|
||||
self.lbry_file_manager,
|
||||
"test_file",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import mock
|
||||
from lbrynet.metadata import LBRYMetadata
|
||||
from lbrynet.lbrynet_daemon import LBRYExchangeRateManager
|
||||
from lbrynet.metadata import Metadata
|
||||
from lbrynet.lbrynet_daemon import ExchangeRateManager
|
||||
|
||||
from twisted.trial import unittest
|
||||
|
||||
|
||||
class LBRYFeeFormatTest(unittest.TestCase):
|
||||
class FeeFormatTest(unittest.TestCase):
|
||||
def test_fee_created_with_correct_inputs(self):
|
||||
fee_dict = {
|
||||
'USD': {
|
||||
|
@ -13,11 +13,11 @@ class LBRYFeeFormatTest(unittest.TestCase):
|
|||
'address': "bRcHraa8bYJZL7vkh5sNmGwPDERFUjGPP9"
|
||||
}
|
||||
}
|
||||
fee = LBRYMetadata.LBRYFeeValidator(fee_dict)
|
||||
fee = Metadata.FeeValidator(fee_dict)
|
||||
self.assertEqual(10.0, fee['USD']['amount'])
|
||||
|
||||
|
||||
class LBRYFeeTest(unittest.TestCase):
|
||||
class FeeTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
patcher = mock.patch('time.time')
|
||||
self.time = patcher.start()
|
||||
|
@ -32,5 +32,5 @@ class LBRYFeeTest(unittest.TestCase):
|
|||
}
|
||||
}
|
||||
rates = {'BTCLBC': {'spot': 3.0, 'ts': 2}, 'USDBTC': {'spot': 2.0, 'ts': 3}}
|
||||
manager = LBRYExchangeRateManager.DummyExchangeRateManager(rates)
|
||||
manager = ExchangeRateManager.DummyExchangeRateManager(rates)
|
||||
self.assertEqual(60.0, manager.to_lbc(fee_dict).amount)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from lbrynet.metadata import LBRYMetadata
|
||||
from lbrynet.metadata import Metadata
|
||||
from twisted.trial import unittest
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ class MetadataTest(unittest.TestCase):
|
|||
def test_assertion_if_no_metadata(self):
|
||||
metadata = {}
|
||||
with self.assertRaises(AssertionError):
|
||||
LBRYMetadata.Metadata(metadata)
|
||||
Metadata.Metadata(metadata)
|
||||
|
||||
def test_assertion_if_source_is_missing(self):
|
||||
metadata = {
|
||||
|
@ -19,7 +19,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
||||
}
|
||||
with self.assertRaises(AssertionError):
|
||||
LBRYMetadata.Metadata(metadata)
|
||||
Metadata.Metadata(metadata)
|
||||
|
||||
def test_metadata_works_without_fee(self):
|
||||
metadata = {
|
||||
|
@ -33,7 +33,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'content-type': 'audio/mpeg',
|
||||
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
||||
}
|
||||
m = LBRYMetadata.Metadata(metadata)
|
||||
m = Metadata.Metadata(metadata)
|
||||
self.assertFalse('fee' in m)
|
||||
|
||||
def test_assertion_if_invalid_source(self):
|
||||
|
@ -49,7 +49,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
||||
}
|
||||
with self.assertRaises(AssertionError):
|
||||
LBRYMetadata.Metadata(metadata)
|
||||
Metadata.Metadata(metadata)
|
||||
|
||||
def test_assertion_if_missing_v001_field(self):
|
||||
metadata = {
|
||||
|
@ -64,7 +64,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg'
|
||||
}
|
||||
with self.assertRaises(AssertionError):
|
||||
LBRYMetadata.Metadata(metadata)
|
||||
Metadata.Metadata(metadata)
|
||||
|
||||
def test_version_is_001_if_all_fields_are_present(self):
|
||||
metadata = {
|
||||
|
@ -78,7 +78,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'content-type': 'audio/mpeg',
|
||||
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
||||
}
|
||||
m = LBRYMetadata.Metadata(metadata, process_now=False)
|
||||
m = Metadata.Metadata(metadata, process_now=False)
|
||||
self.assertEquals('0.0.1', m.version)
|
||||
|
||||
def test_assertion_if_there_is_an_extra_field(self):
|
||||
|
@ -95,7 +95,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'MYSTERYFIELD': '?'
|
||||
}
|
||||
with self.assertRaises(AssertionError):
|
||||
LBRYMetadata.Metadata(metadata, process_now=False)
|
||||
Metadata.Metadata(metadata, process_now=False)
|
||||
|
||||
def test_version_is_002_if_all_fields_are_present(self):
|
||||
metadata = {
|
||||
|
@ -112,7 +112,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'content-type': 'video/mp4',
|
||||
'thumbnail': 'https://svs.gsfc.nasa.gov/vis/a010000/a012000/a012034/Combined.00_08_16_17.Still004.jpg'
|
||||
}
|
||||
m = LBRYMetadata.Metadata(metadata, process_now=False)
|
||||
m = Metadata.Metadata(metadata, process_now=False)
|
||||
self.assertEquals('0.0.2', m.version)
|
||||
|
||||
def test_version_is_003_if_all_fields_are_present(self):
|
||||
|
@ -130,7 +130,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'content_type': 'video/mp4',
|
||||
'thumbnail': 'https://svs.gsfc.nasa.gov/vis/a010000/a012000/a012034/Combined.00_08_16_17.Still004.jpg'
|
||||
}
|
||||
m = LBRYMetadata.Metadata(metadata, process_now=False)
|
||||
m = Metadata.Metadata(metadata, process_now=False)
|
||||
self.assertEquals('0.0.3', m.version)
|
||||
|
||||
def test_version_claimed_is_001_but_version_is_002(self):
|
||||
|
@ -149,7 +149,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'thumbnail': 'https://svs.gsfc.nasa.gov/vis/a010000/a012000/a012034/Combined.00_08_16_17.Still004.jpg'
|
||||
}
|
||||
with self.assertRaises(AssertionError):
|
||||
LBRYMetadata.Metadata(metadata, process_now=False)
|
||||
Metadata.Metadata(metadata, process_now=False)
|
||||
|
||||
def test_version_claimed_is_002_but_version_is_003(self):
|
||||
metadata = {
|
||||
|
@ -167,7 +167,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'thumbnail': 'https://svs.gsfc.nasa.gov/vis/a010000/a012000/a012034/Combined.00_08_16_17.Still004.jpg'
|
||||
}
|
||||
with self.assertRaises(AssertionError):
|
||||
LBRYMetadata.Metadata(metadata, process_now=False)
|
||||
Metadata.Metadata(metadata, process_now=False)
|
||||
|
||||
def test_version_001_ports_to_003(self):
|
||||
metadata = {
|
||||
|
@ -181,7 +181,7 @@ class MetadataTest(unittest.TestCase):
|
|||
'content-type': 'audio/mpeg',
|
||||
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
||||
}
|
||||
m = LBRYMetadata.Metadata(metadata, process_now=True)
|
||||
m = Metadata.Metadata(metadata, process_now=True)
|
||||
self.assertEquals('0.0.3', m.version)
|
||||
|
||||
def test_version_002_ports_to_003(self):
|
||||
|
@ -199,5 +199,5 @@ class MetadataTest(unittest.TestCase):
|
|||
'content-type': 'video/mp4',
|
||||
'thumbnail': 'https://svs.gsfc.nasa.gov/vis/a010000/a012000/a012034/Combined.00_08_16_17.Still004.jpg'
|
||||
}
|
||||
m = LBRYMetadata.Metadata(metadata, process_now=True)
|
||||
m = Metadata.Metadata(metadata, process_now=True)
|
||||
self.assertEquals('0.0.3', m.version)
|
|
@ -2,7 +2,7 @@ import mock
|
|||
import requests
|
||||
from twisted.trial import unittest
|
||||
|
||||
from lbrynet.lbrynet_daemon import LBRYDaemon
|
||||
from lbrynet.lbrynet_daemon import Daemon
|
||||
|
||||
|
||||
class MiscTests(unittest.TestCase):
|
||||
|
@ -18,9 +18,9 @@ class MiscTests(unittest.TestCase):
|
|||
"tag_name": "v0.3.8",
|
||||
"prerelease": False
|
||||
}
|
||||
with mock.patch('lbrynet.lbrynet_daemon.LBRYDaemon.requests') as req:
|
||||
with mock.patch('lbrynet.lbrynet_daemon.Daemon.requests') as req:
|
||||
req.get.return_value = response
|
||||
self.assertEqual('0.3.8', LBRYDaemon.get_lbrynet_version_from_github())
|
||||
self.assertEqual('0.3.8', Daemon.get_lbrynet_version_from_github())
|
||||
|
||||
def test_error_is_thrown_if_prerelease(self):
|
||||
response = mock.create_autospec(requests.Response)
|
||||
|
@ -28,11 +28,11 @@ class MiscTests(unittest.TestCase):
|
|||
"tag_name": "v0.3.8",
|
||||
"prerelease": True
|
||||
}
|
||||
with mock.patch('lbrynet.lbrynet_daemon.LBRYDaemon.requests') as req:
|
||||
with mock.patch('lbrynet.lbrynet_daemon.Daemon.requests') as req:
|
||||
req.get.return_value = response
|
||||
with self.assertRaises(Exception):
|
||||
LBRYDaemon.get_lbrynet_version_from_github()
|
||||
Daemon.get_lbrynet_version_from_github()
|
||||
|
||||
def test_error_is_thrown_when_version_cant_be_parsed(self):
|
||||
with self.assertRaises(Exception):
|
||||
LBRYDaemon.get_version_from_tag('garbage')
|
||||
Daemon.get_version_from_tag('garbage')
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
from twisted.trial import unittest
|
||||
from lbrynet.lbrynet_daemon import LBRYDaemonCLI
|
||||
from lbrynet.lbrynet_daemon import DaemonCLI
|
||||
|
||||
|
||||
class LBRYDaemonCLITests(unittest.TestCase):
|
||||
class DaemonCLITests(unittest.TestCase):
|
||||
def test_guess_type(self):
|
||||
self.assertEqual('0.3.8', LBRYDaemonCLI.guess_type('0.3.8'))
|
||||
self.assertEqual(0.3, LBRYDaemonCLI.guess_type('0.3'))
|
||||
self.assertEqual(3, LBRYDaemonCLI.guess_type('3'))
|
||||
self.assertEqual('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==', LBRYDaemonCLI.guess_type('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA=='))
|
||||
self.assertEqual(0.3, LBRYDaemonCLI.guess_type('0.3'))
|
||||
self.assertEqual('0.3.8', DaemonCLI.guess_type('0.3.8'))
|
||||
self.assertEqual(0.3, DaemonCLI.guess_type('0.3'))
|
||||
self.assertEqual(3, DaemonCLI.guess_type('3'))
|
||||
self.assertEqual('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA==', DaemonCLI.guess_type('VdNmakxFORPSyfCprAD/eDDPk5TY9QYtSA=='))
|
||||
self.assertEqual(0.3, DaemonCLI.guess_type('0.3'))
|
||||
|
||||
def test_get_params(self):
|
||||
test_params = [
|
||||
|
@ -25,4 +25,4 @@ class LBRYDaemonCLITests(unittest.TestCase):
|
|||
'n': 5,
|
||||
'address': 'bY13xeAjLrsjP4KGETwStK2a9UgKgXVTXu'
|
||||
}
|
||||
self.assertDictEqual(test_r, LBRYDaemonCLI.get_params_from_kwargs(test_params))
|
||||
self.assertDictEqual(test_r, DaemonCLI.get_params_from_kwargs(test_params))
|
||||
|
|
Loading…
Reference in a new issue