コード例 #1
0
 def too_many_results(self):
     """RandomNumberDrawForm: Number of results needs to be > 0"""
     form_data = {
         'range_min': 1,
         'range_max': 5,
         'number_of_results': 99999
     }
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #2
0
 def valid_ok_test(self):
     """RandomNumberDrawForm: Correct draw is valid"""
     form_data = {'range_min': 1, 'range_max': 4, 'number_of_results': 1}
     form = RandomNumberDrawForm(data=form_data)
     self.assertTrue(form.is_valid())
コード例 #3
0
 def not_enough_results_ko_test(self):
     """RandomNumberDrawForm: Number of numbers requested less than one is not valid"""
     form_data = {'range_min': 1, 'range_max': 5, 'number_of_results': 0}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #4
0
 def too_many_results_ko_test(self):
     """RandomNumberDrawForm: Too many results requested (over the limit) is not valid"""
     form_data = {'range_min': 1, 'range_max': 5, 'number_of_results': 60}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #5
0
 def range_small_with_repeat_ok_test(self):
     """RandomNumberDrawForm: Small range with repeat is valid"""
     form_data = {'range_min': 1, 'range_max': 5, 'number_of_results': 10, 'allow_repeat': True}
     form = RandomNumberDrawForm(data=form_data)
     self.assertTrue(form.is_valid())
コード例 #6
0
 def range_too_small_ko_test(self):
     """RandomNumberDrawForm: Too small range not valid"""
     form_data = {'range_min': 1, 'range_max': 5, 'number_of_results': 10}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #7
0
 def invalid_range_with_repeat_ko_test(self):
     """RandomNumberDrawForm: Invalid range with repeat not valid"""
     form_data = {'range_min': 5, 'range_max': 4, 'number_of_results': 1, 'allow_repeat': True}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #8
0
 def invalid_range_ko_test(self):
     """RandomNumberDrawForm: Invalid range not valid"""
     form_data = {'range_min': 5, 'range_max': 4, 'number_of_results': 1}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #9
0
 def not_enough_results_ko_test(self):
     """RandomNumberDrawForm: Number of results needs to be > 0"""
     form_data = {'range_min': 1, 'range_max': 5, 'number_of_results': 0}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #10
0
 def too_many_results(self):
     """RandomNumberDrawForm: Number of results needs to be > 0"""
     form_data = {'range_min': 1, 'range_max': 5, 'number_of_results': 99999}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())
コード例 #11
0
 def valid_ok_test(self):
     """RandomNumberDrawForm: Correct draw is valid"""
     form_data = {'range_min': 1, 'range_max': 4, 'number_of_results': 1}
     form = RandomNumberDrawForm(data=form_data)
     self.assertTrue(form.is_valid())
コード例 #12
0
 def not_enough_results_ko_test(self):
     """RandomNumberDrawForm: Number of results needs to be > 0"""
     form_data = {'range_min': 1, 'range_max': 5, 'number_of_results': 0}
     form = RandomNumberDrawForm(data=form_data)
     self.assertFalse(form.is_valid())