コード例 #1
0
ファイル: test_checks.py プロジェクト: yxl201908/ralph
 def test_transition_templates_should_be_a_list_or_tuple(self):
     errors = check_transition_templates('template')
     expected_errors = [
         Error('TRANSITION_TEMPLATES must be a list or a tuple',
               id='transitions.E001')
     ]
     self.assertEqual(expected_errors, errors)
コード例 #2
0
ファイル: test_checks.py プロジェクト: yxl201908/ralph
 def test_transition_templates_item_should_be_two_elements_tuple(self):
     errors = check_transition_templates(
         (('broken', ), 1234, 'foo-bar.html'))
     expected_errors = [
         Error('Element #0 must be a two elements tuple',
               id='transitions.E003'),
         Error('Element #1 must be a two elements tuple',
               id='transitions.E003'),
         Error('Element #2 must be a two elements tuple',
               id='transitions.E003'),
     ]
     self.assertEqual(expected_errors, errors)
コード例 #3
0
ファイル: test_checks.py プロジェクト: yxl201908/ralph
 def test_transition_templates_without_settings(self):
     _, transition, _ = self._create_transition(Order, 'test')
     transition.template_name = 'foo/bar.html'
     transition.save()
     errors = check_transition_templates(None)
     expected_errors = [
         Error(
             'Template foo/bar.html for test transition is defined only'
             ' in transition',
             hint='Change your TRANSITION_TEMPLATES settings by adding '
             '(foo/bar.html, "Your template name") and '
             'then edit test transition',
             id='transitions.E004'),
     ]
     self.assertEqual(expected_errors, errors)
コード例 #4
0
ファイル: apps.py プロジェクト: yxl201908/ralph
def check_transition_settings(app_configs, **kwargs):
    errors = []
    transition_templates = getattr(settings, 'TRANSITION_TEMPLATES', None)
    errors.extend(check_transition_templates(transition_templates))
    return errors
コード例 #5
0
ファイル: test_checks.py プロジェクト: yxl201908/ralph
 def test_empty(self):
     errors = check_transition_templates(None)
     expected_errors = []
     self.assertEqual(expected_errors, errors)
コード例 #6
0
ファイル: test_checks.py プロジェクト: yxl201908/ralph
 def test_transition_templates_should_exist(self):
     errors = check_transition_templates(
         (('transitions/run_transition.html', 'Standard template'), ))
     expected_errors = []
     self.assertEqual(expected_errors, errors)