def _get_file_hash(self): title = ''.join([random.choice(ascii_letters) for i in range(10)]) with open('/tmp/test', 'w') as f: f.write(random._urandom(100)) f = File('/tmp/test', testnet=True, title=title) return f.file_hash, f.file_hash_metadata
def test_file_metadata(self): f = File(FILENAME, testnet=True, title=METADATA['title'], artist=METADATA['artist']) self.assertEqual(f.file_hash_metadata, FILE_HASH_METADATA_TESTNET) self.assertNotEqual(f.file_hash_metadata, f.file_hash)
def test_file_metadata(testnet, file_hash_metadata): from spool import File f = File(FILENAME, testnet=testnet, title='ascribe', artist='Rodolphe Marques') assert f.file_hash_metadata == file_hash_metadata assert f.file_hash_metadata != f.file_hash
def test_file_from_hash(): from spool import File f = File.from_hash(FILE_HASH_TESTNET) assert f.hash == FILE_HASH_TESTNET
def test_file_no_metadata(testnet, file_hash): from spool import File f = File(FILENAME, testnet=testnet) assert f.file_hash == file_hash assert f.file_hash_metadata == file_hash
def test_file_no_metadata(self): f = File(FILENAME) self.assertEqual(f.file_hash, FILE_HASH_MAINNET) self.assertEqual(f.file_hash_metadata, FILE_HASH_MAINNET)
def test_file_no_metadata(self): f = File(FILENAME, testnet=True) self.assertEqual(f.file_hash, FILE_HASH_TESTNET) self.assertEqual(f.file_hash_metadata, FILE_HASH_TESTNET)