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()
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()
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()
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()
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() task_sync_repo_apps_all() task_download_repository_apps() task_synchronize_single_app("testing", 'http://url1/gadget.xml') sync_mongodb_last_hour(None) self.assertApp1() self.assertGraaspAppNotFound() task_synchronize_single_app("testing", 'http://composer.golabz.eu/graasp_i18n/') sync_mongodb_last_hour(None) self.assertGraaspApp()
def test_sync2(self, mock): mock().get = create_requests_mock() synchronize_apps_no_cache_wrapper("testing") sync_mongodb_all(None)