本文整理匯總了Python中devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry類的典型用法代碼示例。如果您正苦於以下問題:Python GradingSystemPluginRegistry類的具體用法?Python GradingSystemPluginRegistry怎麽用?Python GradingSystemPluginRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了GradingSystemPluginRegistry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_render
def test_render(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
self.assignmentbuilder.update(grading_system_plugin_id=MockPointsPluginApi.id)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1)
self.assertEquals(response.status_code, 200)
html = response.content
self.assertEquals(cssGet(html, '.page-header h1').text.strip(),
'How are results presented to the student?')
self.assertEquals(len(cssFind(html, '.devilry_gradingsystem_verbose_selectbox')), 3)
self.assertEquals(cssGet(html, '.passed-failed_points_to_grade_mapper_box h2').text.strip(),
'As passed or failed')
self.assertEquals(cssGet(html, '.passed-failed_points_to_grade_mapper_box a.btn')['href'],
'?points_to_grade_mapper=passed-failed')
self.assertEquals(cssGet(html, '.raw-points_points_to_grade_mapper_box h2').text.strip(),
'As points')
self.assertEquals(cssGet(html, '.raw-points_points_to_grade_mapper_box a.btn')['href'],
'?points_to_grade_mapper=raw-points')
self.assertEquals(cssGet(html, '.custom-table_points_to_grade_mapper_box h2').text.strip(),
'As a text looked up in a custom table')
self.assertEquals(cssGet(html, '.custom-table_points_to_grade_mapper_box a.btn')['href'],
'?points_to_grade_mapper=custom-table')
示例2: test_next_page_invalid_pluginid
def test_next_page_invalid_pluginid(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
with patch('devilry.devilry_gradingsystem.views.admin.selectplugin.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1, {
'grading_system_plugin_id': 'doesnotexist'
})
self.assertEquals(response.status_code, 200)
self.assertIn('Invalid grading system plugin ID: doesnotexist', response.content)
示例3: test_render
def test_render(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
self.assignmentbuilder.update(grading_system_plugin_id=MockPointsPluginApi.id)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1)
self.assertEquals(response.status_code, 200)
html = response.content
self.assertEquals(cssGet(html, '.page-header h1').text.strip(),
'Grading system')
示例4: test_get_not_admin_404_with_pluginselected
def test_get_not_admin_404_with_pluginselected(self):
nobody = UserBuilder('nobody').user
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
with patch('devilry.devilry_gradingsystem.views.admin.selectplugin.gradingsystempluginregistry', myregistry):
self.assertIn(MockPointsPluginApi.id, myregistry)
response = self.get_as(nobody, {
'grading_system_plugin_id': MockPointsPluginApi.id
})
self.assertEquals(response.status_code, 404)
示例5: test_render
def test_render(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
myregistry.add(MockApprovedPluginApi)
with patch('devilry.devilry_gradingsystem.views.admin.selectplugin.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1)
self.assertEquals(response.status_code, 200)
html = response.content
self.assertEquals(cssGet(html, '.page-header h1').text.strip(),
'How would you like to provide feedback to your students?')
self.assertEquals(len(cssFind(html, '.devilry_gradingsystem_verbose_selectbox')), 2)
示例6: test_render_default_to_current_value
def test_render_default_to_current_value(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
self.assignmentbuilder.update(
grading_system_plugin_id=MockPointsPluginApi.id,
max_points=2030
)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1)
html = response.content
self.assertEqual(cssGet(html, '#id_max_points')['value'], '2030')
示例7: test_render
def test_render(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
self.assignmentbuilder.update(grading_system_plugin_id=MockPointsPluginApi.id)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1)
self.assertEqual(response.status_code, 200)
html = response.content
self.assertEqual(cssGet(html, '.page-header h1').text.strip(),
'Set the maximum possible number of points')
self.assertTrue(cssExists(html, '#id_max_points'))
self.assertEqual(cssGet(html, '#id_max_points')['value'], '1') # The default value
示例8: test_invalid_grading_setup
def test_invalid_grading_setup(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
self.assignmentbuilder.update(
grading_system_plugin_id=MockPointsPluginApi.id,
max_points=None
)
response = self.get_as(self.admin1)
self.assertEquals(response.status_code, 200)
html = response.content
self.assertIn('The grading system is not configured correctly.', html)
示例9: test_sets_max_points_automatically
def test_sets_max_points_automatically(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockApprovedPluginApi)
self.assignmentbuilder.update(grading_system_plugin_id=MockApprovedPluginApi.id)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1)
self.assertEqual(response.status_code, 302)
self.assertTrue(response["Location"].endswith(
reverse('devilry_gradingsystem_admin_select_points_to_grade_mapper', kwargs={
'assignmentid': self.assignmentbuilder.assignment.id})))
self.assignmentbuilder.reload_from_db()
self.assertEqual(self.assignmentbuilder.assignment.max_points,
MockApprovedPluginApi(self.assignmentbuilder.assignment).get_max_points())
示例10: test_has_valid_grading_setup_valid_by_default
def test_has_valid_grading_setup_valid_by_default(self):
assignment1 = PeriodBuilder.quickadd_ducku_duck1010_active()\
.add_assignment('assignment1').assignment
# Mock the gradingsystempluginregistry
myregistry = GradingSystemPluginRegistry()
class MockApprovedPluginApi(GradingSystemPluginInterface):
id = 'devilry_gradingsystemplugin_approved'
myregistry.add(MockApprovedPluginApi)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
self.assertTrue(assignment1.has_valid_grading_setup())
示例11: test_next_page_no_configuration_required
def test_next_page_no_configuration_required(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
with patch('devilry.devilry_gradingsystem.views.admin.selectplugin.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1, {
'grading_system_plugin_id': MockPointsPluginApi.id
})
self.assertEquals(response.status_code, 302)
self.assertTrue(response["Location"].endswith(
reverse('devilry_gradingsystem_admin_setmaxpoints', kwargs={
'assignmentid': self.assignmentbuilder.assignment.id})))
self.assignmentbuilder.reload_from_db()
self.assertEquals(self.assignmentbuilder.assignment.grading_system_plugin_id,
MockPointsPluginApi.id)
示例12: test_next_page_requires_configuration
def test_next_page_requires_configuration(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockRequiresConfigurationPluginApi)
with patch('devilry.devilry_gradingsystem.views.admin.selectplugin.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1, {
'grading_system_plugin_id': MockRequiresConfigurationPluginApi.id
})
self.assertEquals(response.status_code, 302)
self.assertEquals(response["Location"],
'http://testserver/mock/requiresconfiguration/configure/{}'.format(
self.assignmentbuilder.assignment.id))
self.assignmentbuilder.reload_from_db()
self.assertEquals(self.assignmentbuilder.assignment.grading_system_plugin_id,
MockRequiresConfigurationPluginApi.id)
示例13: test_post_valid_form
def test_post_valid_form(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
self.assignmentbuilder.update(grading_system_plugin_id=MockPointsPluginApi.id)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.post_as(self.admin1, {
'max_points': 100
})
self.assertEqual(response.status_code, 302)
self.assertTrue(response["Location"].endswith(
reverse('devilry_gradingsystem_admin_select_points_to_grade_mapper', kwargs={
'assignmentid': self.assignmentbuilder.assignment.id})))
self.assignmentbuilder.reload_from_db()
self.assertEqual(self.assignmentbuilder.assignment.max_points, 100)
示例14: test_post_negative_value_shows_error
def test_post_negative_value_shows_error(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
self.assignmentbuilder.update(
grading_system_plugin_id=MockPointsPluginApi.id,
max_points=10
)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.post_as(self.admin1, {
'max_points': -1
})
self.assertEqual(response.status_code, 200)
self.assertEqual(self.assignmentbuilder.assignment.max_points, 10) # Unchanged
html = response.content
self.assertIn('Ensure this value is greater than or equal to 0', html)
示例15: test_next_page_custom_table
def test_next_page_custom_table(self):
myregistry = GradingSystemPluginRegistry()
myregistry.add(MockPointsPluginApi)
self.assignmentbuilder.update(grading_system_plugin_id=MockPointsPluginApi.id)
with patch('devilry.apps.core.models.assignment.gradingsystempluginregistry', myregistry):
response = self.get_as(self.admin1, {
'points_to_grade_mapper': 'custom-table'
})
self.assertEquals(response.status_code, 302)
self.assertTrue(response["Location"].endswith(
reverse('devilry_gradingsystem_admin_setup_custom_table', kwargs={
'assignmentid': self.assignmentbuilder.assignment.id,
})))
self.assignmentbuilder.reload_from_db()
self.assertEquals(self.assignmentbuilder.assignment.points_to_grade_mapper, 'custom-table')