コード例 #1
0
 def test_graphrules_file(self):
     pathgraph = os.path.join(BASEDIR, u"mmąöîgraph")
     uniargs = [u"--out="+pathgraph, u"testmmąöî"]
     dgm_cli.graphrules(self.db, self.config, uniargs)
     assert os.path.exists(pathgraph)
     with open(pathgraph) as f1:
         f1r = f1.read().decode('utf-8')
         val = compare_to_ref("test_graphrules_file", "graph")
         assert val == f1r
コード例 #2
0
    def test_graphrules_nofile(self):
        uniargs = [u"testmmąöî"]
        # The graph is sent to output using logger.output()
        capturer = Capturer(self.logger)
        dgm_cli.graphrules(self.db, self.config, uniargs)
        data = capturer.getCaptured().decode('utf-8')

        val = compare_to_ref("test_graphrules_nofile", "graph")
        assert data == val
コード例 #3
0
    def test_graphrules_file_2rules(self):
        # Add a rule that depends on the one in the test file (mmąöî)
        uniargs_add = [u"testmmąöî", u"mmąöî2", u"fake@mmąöî", u"mmąöî", \
                    u"mmąöî", u"mmąöî", u"mmąöî", u"mmąöî", u"mmąöî"]
        dgm_cli.dbadd(self.db, self.config, uniargs_add)

        pathgraph = os.path.join(BASEDIR, u"mmąöîgraph")
        uniargs = [u"--out="+pathgraph, u"testmmąöî"]
        dgm_cli.graphrules(self.db, self.config, uniargs)
        assert os.path.exists(pathgraph)
        with open(pathgraph) as f1:
            f1r = f1.read().decode('utf-8')
            val = compare_to_ref("test_graphrules_file_2rules", "graph")
            assert val == f1r
コード例 #4
0
    def test_graphrules_nofile_2rules(self):
        # Add a rule that depends on the one in the test file (mmąöî)
        uniargs_add = [u"testmmąöî", u"mmąöî2", u"fake@mmąöî", u"mmąöî", \
                    u"mmąöî", u"mmąöî", u"mmąöî", u"mmąöî", u"mmąöî"]
        dgm_cli.dbadd(self.db, self.config, uniargs_add)

        uniargs = [u"testmmąöî"]
        # The graph is sent to output using logger.output()
        capturer = Capturer(self.logger)
        dgm_cli.graphrules(self.db, self.config, uniargs)
        data = capturer.getCaptured().decode('utf-8')

        val = compare_to_ref("test_graphrules_nofile_2rules", "graph")
        assert data == val