示例#1
0
    def test_check_geonode_is_up(self):
        from contextlib import nested
        from geonode.maps.utils import check_geonode_is_up

        def blowup():
            raise Exception("BOOM")

        with patch('geonode.maps.models.Layer.objects.gs_catalog') as mock_gs:
            mock_gs.get_workspaces.side_effect = blowup

            self.assertRaises(GeoNodeException, check_geonode_is_up)

        with nested(
            patch('geonode.maps.models.Layer.objects.gs_catalog'),
            patch('geonode.maps.models.Layer.objects.geonetwork')
        ) as (mock_gs, mock_gn):
            mock_gn.login.side_effect = blowup
            self.assertRaises(GeoNodeException, check_geonode_is_up)
            self.assertTrue(mock_gs.get_workspaces.called)

        with nested(
            patch('geonode.maps.models.Layer.objects.gs_catalog'),
            patch('geonode.maps.models.Layer.objects.geonetwork')
        ) as (mock_gs, mock_gn):
            # no assertion, this should just run without error
            check_geonode_is_up()
示例#2
0
    def test_check_geonode_is_up(self):
        from contextlib import nested
        from geonode.maps.utils import check_geonode_is_up
        from mock import patch

        def blowup():
            raise Exception("BOOM")

        with patch('geonode.maps.models.Layer.objects.gs_catalog') as mock_gs:
            mock_gs.get_workspaces.side_effect = blowup

            self.assertRaises(GeoNodeException, check_geonode_is_up)

        with nested(patch('geonode.maps.models.Layer.objects.gs_catalog'),
                    patch('geonode.maps.models.Layer.objects.geonetwork')) as (
                        mock_gs, mock_gn):
            mock_gn.login.side_effect = blowup
            self.assertRaises(GeoNodeException, check_geonode_is_up)
            self.assertTrue(mock_gs.get_workspaces.called)

        with nested(patch('geonode.maps.models.Layer.objects.gs_catalog'),
                    patch('geonode.maps.models.Layer.objects.geonetwork')) as (
                        mock_gs, mock_gn):
            # no assertion, this should just run without error
            check_geonode_is_up()
示例#3
0
 def setUp(self):
     """Check geonode and create valid superuser
     """
     check_geonode_is_up()
     self.user = get_valid_user()
示例#4
0
文件: test_api.py 项目: sabman/riab
 def setUp(self):
     check_geonode_is_up()
示例#5
0
 def __init__(self, *args, **kwargs):
     check_geonode_is_up()
     super(GeoNodeTestRunner, self).__init__(*args, **kwargs)