2
1
mirror of https://github.com/deadc0de6/catcli synced 2024-11-11 13:11:00 +00:00
catcli/tests/test_graph.py

45 lines
934 B
Python
Raw Normal View History

2017-12-14 19:06:16 +00:00
"""
author: deadc0de6 (https://github.com/deadc0de6)
Copyright (c) 2017, deadc0de6
2017-12-14 19:09:04 +00:00
Basic unittest for graph
2017-12-14 19:06:16 +00:00
"""
import unittest
from catcli.catcli import *
from catcli.noder import Noder
from catcli.walker import Walker
from catcli.catalog import Catalog
from tests.helpers import *
class TestGraph(unittest.TestCase):
def test_graph(self):
# init
path = 'fake'
gpath = '/tmp/graph.dot'
self.addCleanup(clean, path)
self.addCleanup(clean, gpath)
catalog = Catalog(path, force=True, verbose=False)
top = catalog._restore_json(get_fakecatalog())
noder = Noder()
# create fake args dict
args = {'<path>': gpath, '--verbose': True}
# create the graph
cmd_graph(args, noder, top)
# ensure file exists
self.assertTrue(os.path.exists(gpath))
def main():
unittest.main()
if __name__ == '__main__':
main()