Exemple #1
0
 def __setup(self, se):
     '''Store the raw input for possible later output.'''
     self.tag_raw = se[0]
     self.content_raw = se[1]
     self.comment_raw = se[2]
     # Parse the rest
     tag = self.tag_raw[0:-1]
     value = "".join(se[1])
     comment = TxtParser.extract_comment(se[2])
     RecordEntry.__init__(self, tag, value, comment)
Exemple #2
0
    def test_positive_03(self):
        "Requirement Tag Type - tag given 'design decision'"
        config, req = create_parameters()
        req["Type"] = RecordEntry("Type", "design decision")

        rt = ReqType(config)
        name, value = rt.rewrite("Type-test", req)
        assert (name == "Type")
        assert (value == Requirement.rt_design_decision)
Exemple #3
0
    def test_positive_04(self):
        "Requirement Tag Type - tag given 'requirement'"
        config, req = create_parameters()
        req["Type"] = RecordEntry("Type", "requirement")

        rt = ReqType(config)
        name, value = rt.rewrite("Type-test", req)
        assert (name == "Type")
        assert (value == Requirement.rt_requirement)
Exemple #4
0
    def rmttest_positive_01(self):
        "Requirement Tag Topic - tag given"
        config, req = create_parameters()
        req["Topic"] = RecordEntry("Topic", "This is something")

        rt = ReqTopic(config)
        name, value = rt.rewrite("Topic-test", req)
        assert "Topic" == name
        assert "This is something" == value
Exemple #5
0
    def rmttest_positive_01(self):
        "Requirement Tag Status - tag given 'not done'"
        config, req = create_parameters()
        req["Status"] = RecordEntry("Status", "not done")

        rt = ReqStatus(config)
        name, value = rt.rewrite("Status-test", req)
        assert "Status" == name
        assert isinstance(value, RequirementStatusNotDone)
    def rmttest_positive_02(self):
        "Requirement Tag Rationale - Rationale set"
        config, req = create_parameters()
        req = {"Rationale": RecordEntry("Rationale", "something")}

        rt = ReqRationale(config)
        name, value = rt.rewrite("Rationale-test", req)
        self.assertEqual("Rationale", name)
        self.assertEqual("something", value.get_content())
Exemple #7
0
    def rmttest_positive_03(self):
        "Requirement Tag Class - no Class implementable"
        config, req = create_parameters()
        req = {"Class": RecordEntry("Class", "implementable")}

        rt = ReqClass(config)
        name, value = rt.rewrite("Class-test", req)
        assert "Class" == name
        assert isinstance(value, ClassTypeImplementable)
Exemple #8
0
    def rmttest_positive_01(self):
        "Requirement Tag Invented on - tag given"
        config, req = create_parameters()
        req["Invented on"] = RecordEntry("Invented on", "2010-03-08")

        rt = ReqInventedOn(config)
        name, value = rt.rewrite("InventedOn-test", req)
        assert "Invented on", name
        assert datetime.date(2010, 3, 8), value
Exemple #9
0
    def rmttest_negative_02(self):
        "Requirement Tag Invented on - invalid tag given"
        config, req = create_parameters()
        req["Invented on"] = RecordEntry("Invented on", "2010a-09-01")

        rt = ReqInventedOn(config)
        with pytest.raises(RMTException) as rmte:
            rt.rewrite("InventedOn-test", req)
            assert 8 == rmte.id()
Exemple #10
0
    def rmttest_positive_02(self):
        "Requirement Tag Class - Class set to 'detailable'"
        config, req = create_parameters()
        req = {"Class": RecordEntry("Class", "detailable")}

        rt = ReqClass(config)
        name, value = rt.rewrite("Class-test", req)
        assert "Class" == name
        assert isinstance(value, ClassTypeDetailable)
Exemple #11
0
    def test_positive_01(self):
        "Requirement Tag Description - one word Description"
        config, req = create_parameters()
        req = {"Description": RecordEntry("Description", "short")}

        rt = ReqDescription(config)
        name, value = rt.rewrite("Description-test", req)
        assert (name == "Description")
        assert (value.get_content() == "short")
Exemple #12
0
    def rmttest_negative_02(self):
        "Requirement Tag Type - invalid tag given"
        config, req = create_parameters()
        req["Type"] = RecordEntry("Type", "dasjibtedjarnich")

        rt = ReqType(config)
        with self.assertRaises(RMTException) as rmte:
            rt.rewrite("Type-test", req)
            self.assertEqual(19, rmte.id())
Exemple #13
0
    def rmttest_positive_04(self):
        "Requirement Tag Type - tag given 'requirement'"
        config, req = create_parameters()
        req["Type"] = RecordEntry("Type", "requirement")

        rt = ReqType(config)
        name, value = rt.rewrite("Type-test", req)
        self.assertEqual("Type", name)
        self.assertEqual(RequirementType.requirement, value)
Exemple #14
0
    def rmttest_positive_03(self):
        "Requirement Tag Type - tag given 'design decision'"
        config, req = create_parameters()
        req["Type"] = RecordEntry("Type", "design decision")

        rt = ReqType(config)
        name, value = rt.rewrite("Type-test", req)
        self.assertEqual("Type", name)
        self.assertEqual(RequirementType.design_decision, value)
Exemple #15
0
    def rmttest_negative_02(self):
        "Requirement Tag Status - invalid tag given"
        config, req = create_parameters()
        req["Status"] = RecordEntry("Status", "dasjibtedjarnich")

        rt = ReqStatus(config)
        with pytest.raises(RMTException) as rmte:
            rt.rewrite("Status-test", req)
            assert 91 == rmte.get_id()
Exemple #16
0
 def __init__(self, se):
     '''There must be three entries:
        1) initial line with tag
        2) possible empty list of continue lines (starting with space)
        3) possible empty list of comment and / or empty lines.
     '''
     assert len(se) == 3
     Encoding.check_unicode(se[0])
     self.tag_raw = se[0]
     Encoding.check_unicode_list(se[1])
     self.content_raw = se[1]
     Encoding.check_unicode_list(se[2])
     self.comment_raw = se[2]
     # Parse the rest
     tag = self.tag_raw[0:-1]
     value = "".join(se[1])
     comment = TxtParser.extract_comment(se[2])
     RecordEntry.__init__(self, tag, value, comment)
Exemple #17
0
    def test_positive_02(self):
        "Requirement Tag Description - some words Description"
        config, req = create_parameters()
        d = "This are some words description."
        req = {"Description": RecordEntry("Description", d)}

        rt = ReqDescription(config)
        name, value = rt.rewrite("Description-test", req)
        assert (name == "Description")
        assert (value.get_content() == d)
Exemple #18
0
    def test_positive_02(self):
        "Requirement Tag Effort Estimation - tag given with all valid numbers"
        config, req = create_parameters()

        for i in ReqEffortEst.valid_values:
            req["Effort estimation"] = RecordEntry("Effort estimation", str(i))
            rt = ReqEffortEst(config)
            name, value = rt.rewrite("EffortEstimation-test", req)
            assert (name == "Effort estimation")
            assert (value == i)
Exemple #19
0
    def rmttest_positive_02(self):
        "Requirement Tag Status - tag given 'finished'"
        config, req = create_parameters()
        req["Status"] = RecordEntry("Status", "finished")

        rt = ReqStatus(config)
        name, value = rt.rewrite("Status-test", req)
        assert "Status" == name
        assert isinstance(value, RequirementStatusFinished)
        assert value.get_person() is None
        assert value.get_duration() is None
    def rmttest_positive_02(self):
        "Requirement Tag Effort Estimation - tag given with all valid numbers"
        config, req = create_parameters()

        for i in ReqEffortEst.valid_values:
            req["Effort estimation"] = RecordEntry("Effort estimation",
                                                   Encoding.to_unicode(i))
            rt = ReqEffortEst(config)
            name, value = rt.rewrite("EffortEstimation-test", req)
            assert "Effort estimation" == name
            assert i == value
Exemple #21
0
    def test_pos_04(self):
        "Check top level Record: append entry"

        txt_doc = TxtRecord.from_string(doc1, "Nothing", TxtIOConfig())
        txt_doc.append(RecordEntry("Hinzu", "This is quite new."))
        txt_doc_dict = txt_doc.get_dict()

        assert (txt_doc.get_comment() == dpC1)
        assert (txt_doc_dict["Name"].get_content() == "meiner")
        assert (txt_doc_dict["Note"].get_content() == "This is my Note.")
        assert (txt_doc.to_string() == doc4)
Exemple #22
0
    def rmttest_negative_02(self):
        "Requirement Tag Invented by - invalid tag given"
        config, req = create_parameters()
        config.set_value('requirements.inventors',
                         ["meinereiner", "keinerseiner"])
        req["Invented by"] = RecordEntry("Invented by", "MeinNameIstHase")

        rt = ReqInventedBy(config)
        with pytest.raises(RMTException) as rmte:
            rt.rewrite("InventedBy-test", req)
            assert 6 == rmte.id()
Exemple #23
0
    def test_negative_02(self):
        "Requirement Tag Invented on - invalid tag given"
        config, req = create_parameters()
        req["Invented on"] = RecordEntry("Invented on", "2010a-09-01")

        rt = ReqInventedOn(config)
        try:
            name, value = rt.rewrite("InventedOn-test", req)
            assert (False)
        except RMTException, rmte:
            assert (rmte.id() == 8)
Exemple #24
0
    def rmttest_positive_01(self):
        "Requirement Tag Invented by - tag given"
        config, req = create_parameters()
        config.set_value('requirements.inventors',
                         ["meinereiner", "keinerseiner"])
        req["Invented by"] = RecordEntry("Invented by", "meinereiner")

        rt = ReqInventedBy(config)
        name, value = rt.rewrite("InventedBy-test", req)
        assert "Invented by" == name
        assert "meinereiner" == value
Exemple #25
0
    def rmttest_negative_02(self):
        "Requirement Tag Owner - invalid tag given"
        config, req = create_parameters()
        config.set_value('requirements.stakeholders',
                         ["marketing", "security"])
        req["Owner"] = RecordEntry("Owner", "SomethingDifferent")

        rt = ReqOwner(config)
        with self.assertRaises(RMTException) as rmte:
            rt.rewrite("Owner-test", req)
            self.assertEqual(11, rmte.id())
    def rmttest_positive_03(self):
        "Requirement Tag Priority - tag given two stakeholders"
        config, req = create_parameters()
        config.set_value('requirements.stakeholders',
                         ["marketing", "security"])
        req["Priority"] = RecordEntry("Priority", "marketing:7 security:3")

        rt = ReqPriority(config)
        name, value = rt.rewrite("Priority-test", req)
        assert "Factor" == name
        assert 0.5 == value
Exemple #27
0
    def rmttest_negative_01(self):
        "Requirement Tag Class - unsupported Class value"
        config, req = create_parameters()
        req = {"Class": RecordEntry("Class", "something_completly_different")}

        rt = ReqClass(config)
        try:
            name, value = rt.rewrite("Class-test", req)
            assert False
        except RMTException as rmte:
            assert 95 == rmte.get_id()
Exemple #28
0
    def test_positive_02(self):
        "Requirement Tag Priority - tag given one stakeholder"
        config, req = create_parameters()
        config.set_value('requirements.stakeholders',
                         ["marketing", "security"])
        req["Priority"] = RecordEntry("Priority", "marketing:7")

        rt = ReqPriority(config)
        name, value = rt.rewrite("Priority-test", req)
        assert(name == "Factor")
        assert(value == 0.7)
Exemple #29
0
    def test_negative_02(self):
        "Requirement Tag Type - invalid tag given"
        config, req = create_parameters()
        req["Type"] = RecordEntry("Type", "dasjibtedjarnich")

        rt = ReqType(config)
        try:
            name, value = rt.rewrite("Type-test", req)
            assert (False)
        except RMTException, rmte:
            assert (rmte.id() == 19)
Exemple #30
0
    def test_positive_01(self):
        "Requirement Tag Owner - tag given"
        config, req = create_parameters()
        config.set_value('requirements.stakeholders',
                         ["marketing", "security"])
        req["Owner"] = RecordEntry("Owner", "marketing")

        rt = ReqOwner(config)
        name, value = rt.rewrite("Owner-test", req)
        assert(name == "Owner")
        assert(value == "marketing")
Exemple #31
0
    def test_positive_03(self):
        "Requirement Tag Description - 500 chars description"
        config, req = create_parameters()
        long_text = ""
        for c in xrange(0, 500):
            long_text += "A"
        req = {"Description": RecordEntry("Description", long_text)}

        rt = ReqDescription(config)
        name, value = rt.rewrite("Description-test", req)
        assert (name == "Description")
        assert (value.get_content() == long_text)
Exemple #32
0
 def set_content(self, content):
     '''There is the need to clean up the raw stored content.'''
     RecordEntry.set_content(self, content)
     self.content_raw = None
Exemple #33
0
 def set_comment(self, comment):
     ''' Set the comment.'''
     RecordEntry.set_comment(self, comment)
     self.comment_raw = None