forked from LBRYCommunity/lbry-sdk
fix tests
This commit is contained in:
parent
072ff4b02e
commit
75d1fa585c
2 changed files with 16 additions and 4 deletions
|
@ -323,7 +323,7 @@ class Metadata(Validator):
|
||||||
]
|
]
|
||||||
|
|
||||||
MIGRATE_MV002_TO_MV003 = [
|
MIGRATE_MV002_TO_MV003 = [
|
||||||
(Validator.IF_VAL, 'ver', MV002, (Validator.UPDATE, 'content-type', 'content_type'), Validator.DO_NOTHING),
|
(Validator.IF_KEY, 'content-type', (Validator.UPDATE, 'content-type', 'content_type'), Validator.DO_NOTHING),
|
||||||
(Validator.IF_VAL, 'ver', MV002, (Validator.LOAD, 'ver', MV003), Validator.DO_NOTHING),
|
(Validator.IF_VAL, 'ver', MV002, (Validator.LOAD, 'ver', MV003), Validator.DO_NOTHING),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,24 @@ from twisted.trial import unittest
|
||||||
|
|
||||||
|
|
||||||
class MetadataTest(unittest.TestCase):
|
class MetadataTest(unittest.TestCase):
|
||||||
def test_assertion_if_source_is_missing(self):
|
def test_assertion_if_no_metadata(self):
|
||||||
metadata = {}
|
metadata = {}
|
||||||
with self.assertRaises(AssertionError):
|
with self.assertRaises(AssertionError):
|
||||||
LBRYMetadata.Metadata(metadata)
|
LBRYMetadata.Metadata(metadata)
|
||||||
|
|
||||||
|
def test_assertion_if_source_is_missing(self):
|
||||||
|
metadata = {
|
||||||
|
'license': 'Oscilloscope Laboratories',
|
||||||
|
'description': 'Four couples meet for Sunday brunch only to discover they are stuck in a house together as the world may be about to end.',
|
||||||
|
'language': 'en',
|
||||||
|
'title': "It's a Disaster",
|
||||||
|
'author': 'Written and directed by Todd Berger',
|
||||||
|
'content-type': 'audio/mpeg',
|
||||||
|
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
||||||
|
}
|
||||||
|
with self.assertRaises(AssertionError):
|
||||||
|
LBRYMetadata.Metadata(metadata)
|
||||||
|
|
||||||
def test_metadata_works_without_fee(self):
|
def test_metadata_works_without_fee(self):
|
||||||
metadata = {
|
metadata = {
|
||||||
'license': 'Oscilloscope Laboratories',
|
'license': 'Oscilloscope Laboratories',
|
||||||
|
@ -81,9 +94,8 @@ class MetadataTest(unittest.TestCase):
|
||||||
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
'thumbnail': 'http://ia.media-imdb.com/images/M/MV5BMTQwNjYzMTQ0Ml5BMl5BanBnXkFtZTcwNDUzODM5Nw@@._V1_SY1000_CR0,0,673,1000_AL_.jpg',
|
||||||
'MYSTERYFIELD': '?'
|
'MYSTERYFIELD': '?'
|
||||||
}
|
}
|
||||||
m = LBRYMetadata.Metadata(metadata, process_now=False)
|
|
||||||
with self.assertRaises(AssertionError):
|
with self.assertRaises(AssertionError):
|
||||||
LBRYMetadata.Metadata(metadata)
|
LBRYMetadata.Metadata(metadata, process_now=False)
|
||||||
|
|
||||||
def test_version_is_002_if_all_fields_are_present(self):
|
def test_version_is_002_if_all_fields_are_present(self):
|
||||||
metadata = {
|
metadata = {
|
||||||
|
|
Loading…
Reference in a new issue