Example #1
0
    def test_sync(self, mock_requests, mock_requests_cached_session):
        mock_requests().get = create_requests_mock()
        mock_requests_cached_session().get = create_requests_mock()

        graasp_oauth_login_redirect()
        synchronize_apps_no_cache_wrapper("testing", None)
        self.assertApps()
        self.assertGraaspApp()

        synchronize_apps_no_cache_wrapper("testing", None)
        self.assertApps(before = True)
        self.assertGraaspApp()

        # Add to commons one term which should be applied to tools too.
        request._cached_json = request.values = {
            'app_url': "http://url3/common_gadget.xml",
            'key': 'message1_3',
            'value': 'TESTING_MESSAGE1',
        }
        bundle_update('fr_ALL', 'ALL')

        # Add to tool_ one term which should not be applied to common.
        request._cached_json = request.values = {
            'app_url': "http://url3/tool_gadget.xml",
            'key': 'message5_3',
            'value': 'TESTING_MESSAGE5',
        }
        bundle_update('fr_ALL', 'ALL')

        sync(None, only_recent = True)

        self.assertApps(before = False)
        self.assertGraaspApp()
Example #2
0
    def test_sync(self, mock_requests, mock_requests_cached_session):
        mock_requests().get = create_requests_mock()
        mock_requests_cached_session().get = create_requests_mock()

        graasp_oauth_login_redirect()
        synchronize_apps_no_cache_wrapper("testing", None)
        self.assertApps()
        self.assertGraaspApp()

        synchronize_apps_no_cache_wrapper("testing", None)
        self.assertApps(before=True)
        self.assertGraaspApp()

        # Add to commons one term which should be applied to tools too.
        request._cached_json = request.values = {
            'app_url': "http://url3/common_gadget.xml",
            'key': 'message1_3',
            'value': 'TESTING_MESSAGE1',
        }
        bundle_update('fr_ALL', 'ALL')

        # Add to tool_ one term which should not be applied to common.
        request._cached_json = request.values = {
            'app_url': "http://url3/tool_gadget.xml",
            'key': 'message5_3',
            'value': 'TESTING_MESSAGE5',
        }
        bundle_update('fr_ALL', 'ALL')

        sync(None, only_recent=True)

        self.assertApps(before=False)
        self.assertGraaspApp()
Example #3
0
    def test_sync_single_url(self, mock_requests, mock_requests_cached_session):
        mock_requests().get = create_requests_mock()
        mock_requests_cached_session().get = create_requests_mock()

        graasp_oauth_login_redirect()
        synchronize_apps_no_cache_wrapper("testing", 'http://url1/gadget.xml')
        self.assertApp1()
        self.assertGraaspAppNotFound()
        synchronize_apps_no_cache_wrapper("testing", 'http://composer.golabz.eu/graasp_i18n/')
        self.assertGraaspApp()
Example #4
0
    def test_sync_single_url(self, mock_requests,
                             mock_requests_cached_session):
        mock_requests().get = create_requests_mock()
        mock_requests_cached_session().get = create_requests_mock()

        graasp_oauth_login_redirect()
        synchronize_apps_no_cache_wrapper("testing", 'http://url1/gadget.xml')
        self.assertApp1()
        self.assertGraaspAppNotFound()
        synchronize_apps_no_cache_wrapper(
            "testing", 'http://composer.golabz.eu/graasp_i18n/')
        self.assertGraaspApp()
Example #5
0
 def test_sync2(self, mock):
     mock().get = create_requests_mock()
     synchronize_apps_no_cache_wrapper("testing")
     sync_mongodb_all(None)
Example #6
0
 def test_sync2(self, mock):
     mock().get = create_requests_mock()
     synchronize_apps_no_cache_wrapper("testing")
     sync_mongodb_all(None)