Ejemplo n.º 1
0
 def test_write_document_rdf_mini(self):
     from spdx.writers.rdf import write_document
     doc = self._get_mini_doc()
     temp_dir = ''
     try:
         temp_dir = tempfile.mkdtemp(prefix='test_spdx')
         result_file = os.path.join(temp_dir, 'spdx-simple.rdf')
         with open(result_file, 'wb') as output:
             write_document(doc, output, validate=False)
         expected_file = utils_test.get_test_loc('doc_write/rdf-mini.json')
         utils_test.check_rdf_scan(expected_file, result_file, regen=False)
     finally:
         if temp_dir and os.path.exists(temp_dir):
             shutil.rmtree(temp_dir)
Ejemplo n.º 2
0
    def test_write_document_rdf_with_or_later_with_validate(self):
        from spdx.writers.rdf import write_document
        doc = self._get_lgpl_doc(or_later=True)

        temp_dir = ''
        try:
            temp_dir = tempfile.mkdtemp(prefix='test_spdx')
            result_file = os.path.join(temp_dir, 'spdx-simple-plus.rdf')

            # test proper!
            with open(result_file, 'wb') as output:
                write_document(doc, output, validate=True)

            expected_file = utils_test.get_test_loc(
                'doc_write/rdf-simple-plus.json',
                test_data_dir=utils_test.test_data_dir)

            utils_test.check_rdf_scan(expected_file, result_file, regen=False)
        finally:
            if temp_dir and os.path.exists(temp_dir):
                shutil.rmtree(temp_dir)