2015-08-30 08:09:51 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import unittest
|
|
|
|
import pirate.local
|
|
|
|
import os
|
2018-05-28 07:46:14 +02:00
|
|
|
import base64
|
2015-08-30 08:09:51 +02:00
|
|
|
|
2015-09-04 05:35:12 +02:00
|
|
|
from tests import util
|
|
|
|
|
|
|
|
|
2015-08-30 08:09:51 +02:00
|
|
|
class TestLocal(unittest.TestCase):
|
|
|
|
|
2018-05-28 07:46:14 +02:00
|
|
|
def test_local_csv_db(self):
|
|
|
|
path = util.data_path('db.csv')
|
|
|
|
expected = [
|
|
|
|
{
|
|
|
|
'date':'2018-May-14 11:05:31',
|
|
|
|
'magnet': 'magnet:?xt=urn:btih:34930674EF3BB9317FB5F263CCA830F52685235B&dn=ubuntu-14.04.5-desktop-amd64.iso',
|
|
|
|
'size': '1.0 GiB',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'date': '2018-Apr-15 00:04:09',
|
|
|
|
'magnet': 'magnet:?xt=urn:btih:F07E0B0584745B7BCB35E98097488D34E68623D0&dn=Ubuntu%2017.10.1%20Desktop%20%28amd64%29',
|
|
|
|
'size': '1.4 GiB',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'date': '2017-Aug-01 15:08:07',
|
|
|
|
'magnet': 'magnet:?xt=urn:btih:4096EC129404689CEB8056D907E384FF872C2CE9&dn=LINUX%20UBUNTU%2016.10%2032X64',
|
|
|
|
'size': '1.5 GiB',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
actual = pirate.local.search(path, ('ubuntu',))
|
|
|
|
self.assertEqual(len(actual), len(expected))
|
|
|
|
for i in range(len(expected)):
|
|
|
|
self.assertDictEqual(actual[i], expected[i])
|
2015-08-30 08:09:51 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|