Beispiel #1
0
 def rmttest_adding_req_with_missing_field(self):
     xlsh = xh(self._filename, self.oconfig)
     req = create_req(u'SW-101')
     del (req.values['Invented by'])
     for i in range(len(req.record)):
         if req.record[i].get_content() == 'Q':
             req.record.pop(i)
             break
     with pytest.raises(AssertionError):
         xlsh.add_req(req)
Beispiel #2
0
    def rmttest_adding_req(self):
        xlsh = xh(self._filename, self.oconfig)
        xlsh.add_req(create_req(u'SW-101'))
        xlsh.add_req(create_req(u'SW-102'))
        xlsh.write()

        twb = openpyxl.load_workbook(filename=self._filename)
        rws = twb['Requirements']
        assert rws['A2'].value == "SW-101"
        assert rws['G2'].value == "007"
        assert rws['I2'].value.date().isoformat() == "1970-01-01"

        assert rws['A3'].value == "SW-102"
Beispiel #3
0
    def rmttest_adding_req_header(self):
        xlsh = xh(self._filename, self.oconfig)
        xlsh.write()

        twb = openpyxl.load_workbook(filename=self._filename)
        rws = twb['Requirements']

        i = 0
        for tval in xh.default_config['headers']:
            i += 1
            assert rws.cell(row=1, column=i).value == tval
        assert i == 9
        assert rws['B1'].value == "Name"
Beispiel #4
0
    def rmttest_adding_topic(self):
        xlsh = xh(self._filename, self.oconfig)
        topic_tags = [
            Mock(**{
                'get_tag.return_value': "asdf",
                'get_content.return_value': "qwer"
            })
        ]
        topic_cfg = {'get_tags.return_value': topic_tags}
        topic = Mock(**topic_cfg)
        topic.name = "SuperTopic"
        xlsh.add_topic(topic)
        xlsh.write()

        twb = openpyxl.load_workbook(filename=self._filename)
        rws = twb['Topics']
        assert rws['A1'].value == "SuperTopic"
        assert rws['B1'].value == "asdf"
        assert rws['C1'].value == "qwer"
Beispiel #5
0
    def rmttest_adding_multiple_topics(self):
        """Regression test for topic w/ multiple sub-topics"""
        xlsh = xh(self._filename, self.oconfig)
        # topic_tags is a list of TxtRecordEntry
        topic_tags = [
            Mock(
                **{
                    'get_tag.return_value': "Name",
                    'get_content.return_value': "Need multiple sub-topics"
                }),
            Mock(
                **{
                    'get_tag.return_value': "SubTopic",
                    'get_content.return_value': "qwer"
                }),
            Mock(
                **{
                    'get_tag.return_value': "SubTopic",
                    'get_content.return_value': "asdf"
                })
        ]
        topic_cfg = {'get_tags.return_value': topic_tags}
        topic = Mock(**topic_cfg)
        topic.name = "MultipleSubTopics"
        xlsh.add_topic(topic)
        xlsh.write()

        twb = openpyxl.load_workbook(filename=self._filename)
        rws = twb['Topics']
        assert rws['A1'].value == "MultipleSubTopics"
        assert rws['B1'].value == "Name"
        assert rws['C1'].value == "Need multiple sub-topics"
        assert rws['B2'].value == "SubTopic"
        assert rws['C2'].value == "qwer"
        assert rws['B3'].value == "SubTopic"
        assert rws['C3'].value == "asdf"