mirror of
https://github.com/deadc0de6/catcli
synced 2024-11-15 18:14:01 +00:00
49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
"""
|
|
author: deadc0de6 (https://github.com/deadc0de6)
|
|
Copyright (c) 2017, deadc0de6
|
|
|
|
Basic unittest for find
|
|
"""
|
|
|
|
import unittest
|
|
|
|
from catcli.catcli import cmd_find
|
|
from catcli.noder import Noder
|
|
from catcli.catalog import Catalog
|
|
from tests.helpers import get_fakecatalog
|
|
|
|
|
|
class TestFind(unittest.TestCase):
|
|
"""test find"""
|
|
|
|
def test_find(self):
|
|
"""test find"""
|
|
# init
|
|
catalog = Catalog('fake', force=True, debug=False)
|
|
top = catalog._restore_json(get_fakecatalog())
|
|
noder = Noder()
|
|
|
|
# create fake args
|
|
args = {'<term>': '7544G', '--script': True,
|
|
'--verbose': True, '--parent': False,
|
|
'--directory': False, '--path': None,
|
|
'--format': 'native', '--raw-size': False}
|
|
|
|
# try to find something
|
|
found = cmd_find(args, noder, top)
|
|
self.assertTrue(len(found) > 0)
|
|
|
|
# try to find something that does not exist
|
|
args['<term>'] = 'verynotfoundnote'
|
|
found = cmd_find(args, noder, top)
|
|
self.assertTrue(len(found) == 0)
|
|
|
|
|
|
def main():
|
|
"""entry point"""
|
|
unittest.main()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|