Ejemplo n.º 1
0
 def test_getSettingasbool_setting_value_is_none_raises_attributeerror(
         self, getSettings_mock):
     with self.assertRaisesRegexp(
             AttributeError,
             "'NoneType' object has no attribute 'lower'") as cm:
         actual = kickassbuild.SublimeSettings(
             self.command_mock).getSettingAsBool('any')
Ejemplo n.º 2
0
 def test_getSettingas_parent_commandwindow_has_viewsetting_returns_viewsetting_value(
         self):
     self.command_mock.window.active_view.return_value.settings.return_value = {
         'test-setting': 'test-view-value'
     }
     actual = kickassbuild.SublimeSettings(
         self.command_mock).getSetting('test-setting')
     self.assertEqual('test-view-value', actual)
Ejemplo n.º 3
0
 def test_getSettingas_parent_commandwindow_has_projectsetting_returns_project_setting_value(
         self):
     self.command_mock.window.project_data.return_value = {
         'settings': {
             'test-setting': 'test-project-value'
         }
     }
     actual = kickassbuild.SublimeSettings(
         self.command_mock).getSetting('test-setting')
     self.assertEqual('test-project-value', actual)
Ejemplo n.º 4
0
 def test_getSettingas_parent_commandwindow_has_neither_viewsetting_or_projectsetting_return_empty_string(
         self):
     self.command_mock.window.active_view.return_value.settings.return_value = {
         'test-setting': 'test-view-value'
     }
     self.command_mock.window.project_data.return_value = {
         'settings': {
             'test-setting': 'test-project-value'
         }
     }
     actual = kickassbuild.SublimeSettings(
         self.command_mock).getSetting('test-setting1')
     self.assertEqual('', actual)
Ejemplo n.º 5
0
 def test_getSettingasbool_setting_value_is_capital_true_returns_true(
         self, getSettings_mock):
     actual = kickassbuild.SublimeSettings(
         self.command_mock).getSettingAsBool('any')
     self.assertEqual(True, actual)
Ejemplo n.º 6
0
 def setUp(self):
     self.command_mock = Mock()
     self.command_mock.window.project_data.return_value = None
     self.command_mock.window.active_view.return_value.settings.return_value = {}
     self.target = kickassbuild.SublimeSettings(self.command_mock)
Ejemplo n.º 7
0
 def test_getSetting_no_setting_sexist_returns_empty_string(self):
     actual = kickassbuild.SublimeSettings(
         self.command_mock).getSetting('test-setting')
     self.assertEqual('', actual)
Ejemplo n.º 8
0
 def test_isLoaded_setting_not_exist_returns_false(self):
     self.command_mock.window.active_view.return_value.settings.return_value = {
         'another_setting': 'value'
     }
     actual = kickassbuild.SublimeSettings(self.command_mock).isLoaded()
     self.assertEqual(False, actual)
Ejemplo n.º 9
0
 def test_getSettingasbool_setting_value_is_abc_returns_false(
         self, getSettings_mock):
     actual = kickassbuild.SublimeSettings(
         self.command_mock).getSettingAsBool('any')
     self.assertEqual(False, actual)
Ejemplo n.º 10
0
 def test_isLoaded_setting_exist_returns_true(self):
     self.command_mock.window.active_view.return_value.settings.return_value = {
         'kickass_output_path': 'value'
     }
     actual = kickassbuild.SublimeSettings(self.command_mock).isLoaded()
     self.assertEqual(True, actual)