def test_to_dict(self):
        name = HTMLAPIv1.identifier()
        description = HTMLAPIv1.description()
        version = HTMLAPIv1.version()

        the_dict = HTMLAPIv1.to_dict()

        self.assertEqual(the_dict['name'], name, msg="Name should match")
        self.assertEqual(the_dict['description'], description, msg="Description should match")
        self.assertEqual(the_dict['version'], version, msg="Version should match")
示例#2
0
    def test_to_dict(self):
        name = HTMLAPIv1.identifier()
        description = HTMLAPIv1.description()
        version = HTMLAPIv1.version()

        the_dict = HTMLAPIv1.to_dict()

        self.assertEqual(the_dict['name'], name, msg="Name should match")
        self.assertEqual(the_dict['description'],
                         description,
                         msg="Description should match")
        self.assertEqual(the_dict['version'],
                         version,
                         msg="Version should match")
示例#3
0
    def test_url_replacement(self):
        url = "http://compute.bccvl.org.au/experiments/bioclim-unthemed/bioclim-unthemed-result-2013-11-20t00-47-41-120241/results.html/view/++widget++form.widgets.file/@@download/results.html"

        html_string = '''<html><img src="AUC.png" other_attr='12' other_attr="12" /><img src='ALL.png' other_attr='23' other_attr="12" /></html>'''
        expected_content = '''<html><img src="http://compute.bccvl.org.au/experiments/bioclim-unthemed/bioclim-unthemed-result-2013-11-20t00-47-41-120241/AUC.png/view/++widget++form.widgets.file/@@download/AUC.png" other_attr='12' other_attr="12" /><img src="http://compute.bccvl.org.au/experiments/bioclim-unthemed/bioclim-unthemed-result-2013-11-20t00-47-41-120241/ALL.png/view/++widget++form.widgets.file/@@download/ALL.png" other_attr='23' other_attr="12" /></html>'''

        out_content = HTMLAPIv1.replace_urls(html_string, url)

        self.assertEqual(out_content, expected_content)
    def test_url_replacement(self):
        url = "http://compute.bccvl.org.au/experiments/bioclim-unthemed/bioclim-unthemed-result-2013-11-20t00-47-41-120241/results.html/view/++widget++form.widgets.file/@@download/results.html"

        html_string = '''<html><img src="AUC.png" other_attr='12' other_attr="12" /><img src='ALL.png' other_attr='23' other_attr="12" /></html>'''
        expected_content = '''<html><img src="http://compute.bccvl.org.au/experiments/bioclim-unthemed/bioclim-unthemed-result-2013-11-20t00-47-41-120241/AUC.png/view/++widget++form.widgets.file/@@download/AUC.png" other_attr='12' other_attr="12" /><img src="http://compute.bccvl.org.au/experiments/bioclim-unthemed/bioclim-unthemed-result-2013-11-20t00-47-41-120241/ALL.png/view/++widget++form.widgets.file/@@download/ALL.png" other_attr='23' other_attr="12" /></html>'''

        out_content = HTMLAPIv1.replace_urls(html_string, url)

        self.assertEqual(out_content, expected_content)
    def view(self):

        log = logging.getLogger(__name__)
        log.debug('Processing view request in HTML API v1')

        data_url = self.request.GET.getone('data_url')

        content = None
        MyDataMover = FDataMover.get_data_mover_class()
        with MyDataMover.open(data_url=data_url) as f:
            content = f.read()

        out_str = HTMLAPIv1.replace_urls(content, data_url)

        response = Response(out_str, content_type="text/html")
        return response
示例#6
0
    def view(self):

        log = logging.getLogger(__name__)
        log.debug('Processing view request in HTML API v1')

        data_url = self.request.GET.getone('data_url')

        content = None
        MyDataMover = FDataMover.get_data_mover_class()
        with MyDataMover.open(data_url=data_url) as f:
            content = f.read()

        out_str = HTMLAPIv1.replace_urls(content, data_url)

        response = Response(out_str, content_type="text/html")
        return response
示例#7
0
 def test_version(self):
     self.assertEqual(HTMLAPIv1.version(), 1, msg="Version should be 1")
 def _to_dict(self):
     return HTMLAPIv1.to_dict()
 def test_version(self):
     self.assertEqual(HTMLAPIv1.version(), 1, msg="Version should be 1")
示例#10
0
 def _to_dict(self):
     return HTMLAPIv1.to_dict()