예제 #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()
예제 #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()
예제 #3
0
def synchronize_apps_no_cache_wrapper(self, source = None, single_app_url = None, must_sync = True):
    if source is None:
        source = 'scheduled'
    with my_app.app_context():
        result = synchronize_apps_no_cache(source = source, single_app_url = single_app_url)
    if must_sync:
        sync(self, False)
    return result
예제 #4
0
def sync_wrapper(self):
    return sync(self, True)
예제 #5
0
def sync_no_cache_wrapper(self):
    return sync(self, False)
예제 #6
0
def synchronize_apps_no_cache_wrapper(self):
    with my_app.app_context():
        result = synchronize_apps_no_cache()
    sync(self)
    return result