本文整理汇总了Python中devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry.add方法的典型用法代码示例。如果您正苦于以下问题:Python GradingSystemPluginRegistry.add方法的具体用法?Python GradingSystemPluginRegistry.add怎么用?Python GradingSystemPluginRegistry.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry
的用法示例。
在下文中一共展示了GradingSystemPluginRegistry.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_render
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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_default_to_current_value
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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')
示例6: test_render
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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)
示例7: test_render
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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_has_valid_grading_setup_valid_by_default
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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())
示例10: test_sets_max_points_automatically
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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())
示例11: test_post_valid_form
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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)
示例12: test_next_page_no_configuration_required
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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)
示例13: test_next_page_requires_configuration
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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)
示例14: test_post_negative_value_shows_error
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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
# 需要导入模块: from devilry.devilry_gradingsystem.pluginregistry import GradingSystemPluginRegistry [as 别名]
# 或者: from devilry.devilry_gradingsystem.pluginregistry.GradingSystemPluginRegistry import add [as 别名]
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')