Exemple #1
0
 def test_to_csv(self):
     subcategory = Subcategory(id='{00000000-0000-0000-0000-000000000000}', name='Example')
     inclusion_setting = SettingValue()
     subcategory_setting = SubcategorySetting(subcategory=subcategory, inclusion_setting=inclusion_setting)
     self.assertEqual(
         subcategory_setting.to_csv(), 
         ',System,Example,{00000000-0000-0000-0000-000000000000},No Auditing,,0\n'
     )
Exemple #2
0
 def test_valid_settings_element(self):
     subcategory = Subcategory(id='{00000000-0000-0000-0000-000000000000}',
                               name='Example')
     inclusion_setting = SettingValue()
     subcategory_setting = SubcategorySetting(
         subcategory=subcategory, inclusion_setting=inclusion_setting)
     policy = AuditPolicy(settings=[subcategory_setting])
     self.assertEqual(policy.settings[0].subcategory.id,
                      '{00000000-0000-0000-0000-000000000000}')
Exemple #3
0
 def test_int_failure(self):
     settin_value = SettingValue(failure=True)
     self.assertEqual(int(settin_value), 2)
Exemple #4
0
 def test_int_success(self):
     settin_value = SettingValue(success=True)
     self.assertEqual(int(settin_value), 1)
Exemple #5
0
    def test_invalid_subcategory_type(self):
        inclusion_setting = SettingValue()

        with self.assertRaises(TypeError):
            SubcategorySetting(subcategory=None, inclusion_setting=inclusion_setting)
Exemple #6
0
 def test_from_value_text_failure(self):
     settin_value = SettingValue.from_value_text('Failure')
     self.assertEqual((settin_value.success, settin_value.failure), (False, True))
Exemple #7
0
 def test_from_value_text_no_auditing(self):
     settin_value = SettingValue.from_value_text('No Auditing')
     self.assertEqual((settin_value.success, settin_value.failure), (False, False))
Exemple #8
0
 def test_str_success_and_failure(self):
     settin_value = SettingValue(success=True, failure=True)
     self.assertEqual(str(settin_value), 'Success and Failure')
Exemple #9
0
 def test_str_success(self):
     settin_value = SettingValue(success=True)
     self.assertEqual(str(settin_value), 'Success')
Exemple #10
0
 def test_valid_success(self):
     settin_value = SettingValue(success=True)
     self.assertEqual(settin_value.success, True)
Exemple #11
0
 def test_default_success(self):
     settin_value = SettingValue()
     self.assertEqual(settin_value.success, False)
Exemple #12
0
 def test_value_include_success_and_failure(self):
     subcategory = Subcategory(id='{00000000-0000-0000-0000-000000000000}', name='Example')
     inclusion_setting = SettingValue(success=True, failure=True)
     subcategory_setting = SubcategorySetting(subcategory=subcategory, inclusion_setting=inclusion_setting)
     self.assertEqual(subcategory_setting.value, 3)
Exemple #13
0
 def test_value_include_no_auditing(self):
     subcategory = Subcategory(id='{00000000-0000-0000-0000-000000000000}', name='Example')
     inclusion_setting = SettingValue()
     subcategory_setting = SubcategorySetting(subcategory=subcategory, inclusion_setting=inclusion_setting)
     self.assertEqual(subcategory_setting.value, 0)
Exemple #14
0
 def test_valid_inclusion_setting(self):
     subcategory = Subcategory(id='{00000000-0000-0000-0000-000000000000}', name='Example')
     inclusion_setting = SettingValue()
     subcategory_setting = SubcategorySetting(subcategory=subcategory, inclusion_setting=inclusion_setting)
     self.assertEqual(subcategory_setting.inclusion_setting.success, False)
Exemple #15
0
 def test_int_success_and_failure(self):
     settin_value = SettingValue(success=True, failure=True)
     self.assertEqual(int(settin_value), 3)
Exemple #16
0
 def test_str_no_auditing(self):
     settin_value = SettingValue()
     self.assertEqual(str(settin_value), 'No Auditing')
Exemple #17
0
 def test_invalid_success_type(self):
     with self.assertRaises(TypeError):
         SettingValue(success=None)
Exemple #18
0
 def test_str_failure(self):
     settin_value = SettingValue(failure=True)
     self.assertEqual(str(settin_value), 'Failure')
Exemple #19
0
 def test_default_failure(self):
     settin_value = SettingValue()
     self.assertEqual(settin_value.failure, False)
Exemple #20
0
 def test_from_value_success_and_failure(self):
     settin_value = SettingValue.from_value(3)
     self.assertEqual((settin_value.success, settin_value.failure), (True, True))
Exemple #21
0
 def test_valid_failure(self):
     settin_value = SettingValue(failure=True)
     self.assertEqual(settin_value.failure, True)
Exemple #22
0
 def test_from_value_text_success(self):
     settin_value = SettingValue.from_value_text('Success')
     self.assertEqual((settin_value.success, settin_value.failure), (True, False))
Exemple #23
0
 def test_invalid_failure_type(self):
     with self.assertRaises(TypeError):
         SettingValue(failure=None)
Exemple #24
0
 def test_int_no_auditing(self):
     settin_value = SettingValue()
     self.assertEqual(int(settin_value), 0)
Exemple #25
0
 def test_from_value_text_success_and_failure(self):
     settin_value = SettingValue.from_value_text('Success and Failure')
     self.assertEqual((settin_value.success, settin_value.failure), (True, True))