Skip to content

Commit

Permalink
- Add test for testing if the plugins we install are indeed installed.
Browse files Browse the repository at this point in the history
- Add close() after client.get() to get rid of the 'file not closed' warning.
  • Loading branch information
remyzandwijk committed Apr 26, 2020
1 parent 20fa599 commit 0456754
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test_flask_ckeditor.py
Expand Up @@ -73,12 +73,15 @@ def test_local_resources(self):
current_app.config['CKEDITOR_SERVE_LOCAL'] = True

response = self.client.get('/ckeditor/static/basic/ckeditor.js')
response.close()
self.assertNotEqual(response.status_code, 404)

response = self.client.get('/ckeditor/static/standard/ckeditor.js')
response.close()
self.assertNotEqual(response.status_code, 404)

response = self.client.get('/ckeditor/static/full/ckeditor.js')
response.close()
self.assertNotEqual(response.status_code, 404)

rv = self.ckeditor.load()
Expand Down Expand Up @@ -171,3 +174,29 @@ def test_csrf_protect(self):
current_app.config['CKEDITOR_ENABLE_CSRF'] = True
rv = self.ckeditor.config()
self.assertIn('X-CSRFToken', rv)

def test_local_resources_plugins(self):
# basic package plugins
plugins = {'filebrowser', 'lineutils', 'widgetselection',
'codesnippet', 'filetools', 'popup', 'widget'}
for plugin in plugins:
url = '/ckeditor/static/basic/plugins/%s/plugin.js' % plugin
response = self.client.get(url)
response.close()
self.assertEqual(response.status_code, 200)

# standard package plugins
plugins = {'codesnippet', 'filetools', 'popup', 'widget'}
for plugin in plugins:
url = '/ckeditor/static/standard/plugins/%s/plugin.js' % plugin
response = self.client.get(url)
response.close()
self.assertEqual(response.status_code, 200)

# full package plugins
plugins = {'codesnippet', 'filetools', 'popup', 'widget'}
for plugin in plugins:
url = '/ckeditor/static/full/plugins/%s/plugin.js' % plugin
response = self.client.get(url)
response.close()
self.assertEqual(response.status_code, 200)

0 comments on commit 0456754

Please sign in to comment.