Skip to content

Commit

Permalink
Merge pull request #499 from edx/dcs/remove-warning
Browse files Browse the repository at this point in the history
Remove noisy warning and make tests more unique
  • Loading branch information
davestgermain authored Jan 3, 2019
2 parents 0cc8e5c + ce41810 commit f238f04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions edx_proctoring/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,11 @@ def ready(self):
config = settings.PROCTORING_BACKENDS

self.backends = {} # pylint: disable=W0201
not_found = []
for extension in ExtensionManager(namespace='openedx.proctoring'):
name = extension.name
try:
options = config[name]
self.backends[name] = extension.plugin(**options)
except KeyError:
not_found.append(name)
if not_found: # pragma: no branch
warnings.warn("No proctoring backend configured for '{}'. "
"Available: {}".format(not_found, list(self.backends)))
pass
make_worker_config(self.backends.values(), out=os.path.join(settings.ENV_ROOT, 'workers.json'))
12 changes: 6 additions & 6 deletions edx_proctoring/tests/test_workerconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def _check_outfile(self, expected):

def test_create_success(self):
backend = TestBackendProvider()
backend.npm_module = self._make_npm_module('test-1234', 'foo/bar/baz.js')
backend.npm_module = self._make_npm_module('success', 'foo/bar/baz.js')
self.assertTrue(make_worker_config([backend], self.outfile))
self._check_outfile(
{'test-1234': [
{'success': [
'babel-polyfill',
'/tmp/test-proctoring-modules/test-1234/foo/bar/baz.js'
'/tmp/test-proctoring-modules/success/foo/bar/baz.js'
]}
)

Expand All @@ -70,7 +70,7 @@ def test_not_defined(self):

def test_no_main(self):
backend = TestBackendProvider()
backend.npm_module = self._make_npm_module('test-1234')
backend.npm_module = self._make_npm_module('no-main')
self.assertFalse(make_worker_config([backend], self.outfile))
self._check_outfile(None)

Expand All @@ -83,13 +83,13 @@ def test_no_module(self):
def test_no_permission(self):
self.outfile = '/etc/workers-test.json'
backend = TestBackendProvider()
backend.npm_module = self._make_npm_module('test-1234', 'foo/bar/baz.js')
backend.npm_module = self._make_npm_module('no-perm', 'foo/bar/baz.js')
self.assertFalse(make_worker_config([backend], self.outfile))
self._check_outfile(None)

@patch('django.conf.settings.NODE_MODULES_ROOT', None)
def test_no_setting(self):
backend = TestBackendProvider()
backend.npm_module = 'test-1234'
backend.npm_module = 'no-setting'
self.assertFalse(make_worker_config([backend], self.outfile))
self._check_outfile(None)

0 comments on commit f238f04

Please sign in to comment.