def test_conversion(self):

        # no conversion, but check of mime type
        self.assertEqual(utils.check_format('application/pdf', convert=False),
                         'application/pdf')

        # conversion to purl.org url
        self.assertEqual(utils.check_format('application/pdf', convert=True),
                         'http://purl.org/NET/mediatypes/application/pdf')
    def test_conversion(self):

        # no conversion, but check of mime type
        self.assertEqual(utils.check_format('application/pdf', convert=False),
                         'application/pdf')

        # conversion to purl.org url
        self.assertEqual(utils.check_format('application/pdf', convert=True),
                         'http://purl.org/NET/mediatypes/application/pdf')
    def test_formatcheck(self):

        with self.assertRaises(exceptions.CombineArchiveFormatException):
            utils.check_format('foobar', convert=False)  # no mime type or url
        with self.assertRaises(exceptions.CombineArchiveFormatException):
            utils.check_format(
                'ftp://purl.org/mediatypes/application/pdf'
            )  # not a valid url schema (only https? allowed)
        with self.assertRaises(exceptions.CombineArchiveFormatException):
            utils.check_format('http://not-an-form-url.org/bla'
                               )  # not a valid url for format specification

        # check for identifiers urls
        self.assertEqual(
            utils.check_format(
                'http://identifiers.org/combine.specifications/cellml'),
            'http://identifiers.org/combine.specifications/cellml',
            'check_format alternated identifiers.org link')

        self.assertEqual(
            utils.check_format(
                'http://identifiers.org/combine.specifications/sbml.level-3.version-1'
            ),
            'http://identifiers.org/combine.specifications/sbml.level-3.version-1',
            'check_format alternated identifiers.org link')
    def test_formatcheck(self):

        with self.assertRaises(exceptions.CombineArchiveFormatException):
            utils.check_format('foobar', convert=False)                        # no mime type or url
        with self.assertRaises(exceptions.CombineArchiveFormatException):
            utils.check_format('ftp://purl.org/mediatypes/application/pdf')    # not a valid url schema (only https? allowed)
        with self.assertRaises(exceptions.CombineArchiveFormatException):
            utils.check_format('http://not-an-form-url.org/bla')               # not a valid url for format specification

        # check for identifiers urls
        self.assertEqual(utils.check_format('http://identifiers.org/combine.specifications/cellml'),
                         'http://identifiers.org/combine.specifications/cellml',
                         'check_format alternated identifiers.org link')

        self.assertEqual(utils.check_format('http://identifiers.org/combine.specifications/sbml.level-3.version-1'),
                         'http://identifiers.org/combine.specifications/sbml.level-3.version-1',
                         'check_format alternated identifiers.org link')