Example #1
0
    def test_neg_01(self):
        "LaTeX output: check invalid tag in topic"

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        tvcs = TestVCS(tcfg)
        tfile = tvcs.get_tfile1()

        dg = Digraph()

        topic = Topic(dg, "TName", tvcs, None, tfile, None)
        topic.t = [RecordEntry("CompleteleOther", "My content"), ]
        tmpdir = create_tmp_dir()

        rset = RequirementSet(tcfg)

        ttopic_set = TestTopicSet(rset)

        mconfig = {"output_filename": os.path.join(tmpdir, "TestLateX2Out.tex")}
        l2 = latex2(mconfig)

        try:
            l2.topic_set_pre(ttopic_set)
            topic.execute(l2, "")
            assert(False)
        except RMTException, rmte:
            pass
Example #2
0
    def rmttest_neg_01(self):
        "LaTeX output: check invalid tag in topic"

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        tvcs = TestVCS(tcfg)
        tfile = tvcs.get_tfile1()

        topic = Topic(None, u"TName", tvcs, None, tfile, None)
        topic.t = [
            RecordEntry(u"CompleteleOther", u"My content"),
        ]

        rset = RequirementSet(tcfg)

        ttopic_set = TestTopicSet(rset)

        mconfig = self.__def_mconfig
        req_proc = latex2(mconfig)

        try:
            req_proc.topic_set_pre(ttopic_set)
            topic.execute(req_proc, "")
            assert False
        except RMTException:
            pass
        req_proc.topic_set_post(ttopic_set)
Example #3
0
    def rmttest_neg_01(self):
        "LaTeX output: check invalid tag in topic"

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        tvcs = TestVCS(tcfg)
        tfile = tvcs.get_tfile1()

        topic = Topic(None, u"TName", tvcs, None, tfile, None)
        topic.t = [
            RecordEntry(u"CompleteleOther", u"My content"),
        ]
        tmpdir = create_tmp_dir()

        rset = RequirementSet(tcfg)

        ttopic_set = TestTopicSet(rset)

        mconfig = {
            "output_filename": os.path.join(tmpdir, "TestLateX2Out.tex")
        }
        out_l2 = latex2(mconfig)

        try:
            out_l2.topic_set_pre(ttopic_set)
            topic.execute(out_l2, "")
            assert False
        except RMTException:
            pass
        out_l2.topic_set_post(ttopic_set)
        delete_tmp_dir(tmpdir)
Example #4
0
    def rmttest_neg_01(self):
        "LaTeX output: check invalid tag in topic"

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        tvcs = TestVCS(tcfg)
        tfile = tvcs.get_tfile1()

        topic = Topic(None, u"TName", tvcs, None, tfile, None)
        topic.t = [RecordEntry(u"CompleteleOther", u"My content"), ]

        rset = RequirementSet(tcfg)

        ttopic_set = TestTopicSet(rset)

        mconfig = self.__def_mconfig
        req_proc = latex2(mconfig)

        try:
            req_proc.topic_set_pre(ttopic_set)
            topic.execute(req_proc, "")
            assert False
        except RMTException:
            pass
        req_proc.topic_set_post(ttopic_set)
Example #5
0
    def rmttest_def_req(self):
        "LaTeX output: compare output to defined value"
        exp_value = r"""
\paragraph{my name}

\hypertarget{TestReq}{TestReq} 
\label{TestReq}

my desc

\textbf{Rationale:} 

\textbf{Note:} 





\par{\small \begin{center}
\begin{tabular}{rlrlrl}
   Id: & TestReq               & Priority: &           & Owner: &  \\
   Invented on: &  & Invented by: &  & Status: & finished (meiner, 2011-04-15, 4 h) \\
   Class: & implementable
\end{tabular}\end{center}
}
""" # noqa

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        mconfig = self.__def_mconfig
        mconfig['req_attributes'] = ["Status", "Class", "DoesNotExists"]

        req_proc = latex2(mconfig)
        req = Requirement(None, u"TestReq", None, None, None)
        req.values = {}
        req.values[u"Name"] = RecordEntry(u"Name", u"my name")
        req.values[u"Type"] = RequirementType.requirement
        req.values[u"Description"] = RecordEntry(u"Description", u"my desc")
        req.values[u"Status"] = RequirementStatusFinished(
            None, u"rid", u"finished:meiner:2011-04-15:4h")
        req.values[u"Class"] = ClassTypeImplementable()

        ce3set = CE3Set()
        ce3 = CE3()
        ce3set.insert(u"TestReq", ce3)
        ''' This is here for future? use.
        rset = RequirementSet(tcfg)
        ttopic_set = TestTopicSet(rset)
        '''

        req_text = req_proc._get_requirement(req)
        try:
            assert req_text == exp_value
        except AssertionError:
            import difflib
            diff = difflib.ndiff(req_text.splitlines(True),
                                 exp_value.splitlines(True))
            print(''.join(diff))
            raise Exception("The template is not equal to it's expected value")
Example #6
0
    def rmttest_neg_02(self):
        "LaTeX output: check invalid tag in requirement output config"

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        # ToDo: is this needed? tvcs = TestVCS(tcfg)
        # ToDo: is this needed? tfile = tvcs.get_tfile1()

        tmpdir = create_tmp_dir()
        mconfig = {
            "req_attributes": ["Status", "Class", "DoesNotExists"],
            "output_filename": os.path.join(tmpdir, "TestLateX2Out.tex")
        }

        out_l2 = latex2(mconfig)
        req = Requirement(None, u"TestReq", None, None, None)
        req.values = {}
        req.values[u"Name"] = RecordEntry(u"Name", u"my name")
        req.values[u"Type"] = RequirementType.requirement
        req.values[u"Description"] = RecordEntry(u"Description", u"my desc")
        req.values[u"Status"] = RequirementStatusFinished(
            None, u"rid", u"finished:meiner:2011-04-15:4h")
        req.values[u"Class"] = ClassTypeImplementable()

        ce3set = CE3Set()
        ce3 = CE3()
        ce3set.insert(u"TestReq", ce3)

        rset = RequirementSet(tcfg)
        ttopic_set = TestTopicSet(rset)

        try:
            out_l2.topic_set_pre(None)
            req.execute(out_l2, "")
            assert False
        except RMTException:
            pass
        out_l2.topic_set_post(ttopic_set)
        delete_tmp_dir(tmpdir)
Example #7
0
    def rmttest_neg_02(self):
        "LaTeX output: check invalid tag in requirement output config"

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        # ToDo: is this needed? tvcs = TestVCS(tcfg)
        # ToDo: is this needed? tfile = tvcs.get_tfile1()

        tmpdir = create_tmp_dir()
        mconfig = {"req_attributes": ["Status", "Class", "DoesNotExists"],
                   "output_filename":
                   os.path.join(tmpdir, "TestLateX2Out.tex")}

        out_l2 = latex2(mconfig)
        req = Requirement(None, u"TestReq", None, None, None)
        req.values = {}
        req.values[u"Name"] = RecordEntry(u"Name", u"my name")
        req.values[u"Type"] = RequirementType.requirement
        req.values[u"Description"] = RecordEntry(u"Description", u"my desc")
        req.values[u"Status"] = RequirementStatusFinished(
            None, u"rid", u"finished:meiner:2011-04-15:4h")
        req.values[u"Class"] = ClassTypeImplementable()

        ce3set = CE3Set()
        ce3 = CE3()
        ce3set.insert(u"TestReq", ce3)

        rset = RequirementSet(tcfg)
        ttopic_set = TestTopicSet(rset)

        try:
            out_l2.topic_set_pre(None)
            req.execute(out_l2, "")
            assert False
        except RMTException:
            pass
        out_l2.topic_set_post(ttopic_set)
        delete_tmp_dir(tmpdir)
Example #8
0
    def test_neg_02(self):
        "LaTeX output: check invalid tag in requirement output config"

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        tvcs = TestVCS(tcfg)
        tfile = tvcs.get_tfile1()

        tmpdir = create_tmp_dir()
        mconfig = { "req_attributes": ["Status", "Class", "DoesNotExists"],
                    "output_filename": os.path.join(tmpdir, "TestLateX2Out.tex")}

        l2 = latex2(mconfig)
        req = Requirement(None, "TestReq", None, None, None)
        req.values = {}
        req.values["Name"] = RecordEntry("Name", "my name")
        req.values["Type"] = Requirement.rt_requirement
        req.values["Description"] = RecordEntry("Description", "my desc")
        req.values["Status"] = RequirementStatusFinished(
                None, "rid", "finished:meiner:2011-04-15:4h")
        req.values["Class"] = ClassTypeImplementable()

        dnreq = RequirementDNode(req)

        ce3set = CE3Set()
        ce3 = CE3()
        ce3set.insert("TestReq", ce3)

        rset = RequirementSet(tcfg)
        ttopic_set = TestTopicSet(rset)

        try:
            l2.topic_set_pre(None)
            dnreq.execute(l2, "")
            assert(False)
        except RMTException, rmte:
            pass
Example #9
0
    def rmttest_def_req(self):
        "LaTeX output: compare output to defined value"
        exp_value = r"""
\paragraph{my name}

\hypertarget{TestReq}{TestReq} 
\label{TestReq}

my desc

\textbf{Rationale:} 

\textbf{Note:} 







\par{\small \begin{center}
\begin{tabular}{rlrlrl}
   Id: & TestReq               & Priority: &           & Owner: &  \\
   Invented on: &  & Invented by: &  & Status: & finished (meiner, 2011-04-15, 4 h) \\
   Class: & implementable
\end{tabular}\end{center}
}
""" # noqa

        tcfg = TestConfig()
        tcfg.set_output_cfg()

        mconfig = self.__def_mconfig
        mconfig['req_attributes'] = ["Status", "Class", "DoesNotExists"]

        req_proc = latex2(mconfig)
        req = Requirement(None, u"TestReq", None, None, None)
        req.values = {}
        req.values[u"Name"] = RecordEntry(u"Name", u"my name")
        req.values[u"Type"] = RequirementType.requirement
        req.values[u"Description"] = RecordEntry(u"Description", u"my desc")
        req.values[u"Status"] = RequirementStatusFinished(
            None, u"rid", u"finished:meiner:2011-04-15:4h")
        req.values[u"Class"] = ClassTypeImplementable()

        ce3set = CE3Set()
        ce3 = CE3()
        ce3set.insert(u"TestReq", ce3)

        ''' This is here for future? use.
        rset = RequirementSet(tcfg)
        ttopic_set = TestTopicSet(rset)
        '''

        req_text = req_proc._get_requirement(req)
        try:
            assert req_text == exp_value
        except AssertionError:
            import difflib
            diff = difflib.ndiff(
                req_text.splitlines(True),
                exp_value.splitlines(True))
            print(''.join(diff))
            raise Exception("The template is not equal to it's expected value")