Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
def test_file_from_hash():
    from spool import File
    f = File.from_hash(FILE_HASH_TESTNET)
    assert f.hash == FILE_HASH_TESTNET
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
def test_file_from_hash():
    from spool import File
    f = File.from_hash(FILE_HASH_TESTNET)
    assert f.hash == FILE_HASH_TESTNET
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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)