Skip to content

Commit

Permalink
Fix deb_apache states methods tense
Browse files Browse the repository at this point in the history
  • Loading branch information
zigarn committed Dec 13, 2015
1 parent f4e4fd3 commit f3a2b27
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions salt/states/apache_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __virtual__():
return 'apache_conf' if 'apache.a2enconf' in __salt__ and salt.utils.which('a2enconf') else False


def enable(name):
def enabled(name):
'''
Ensure an Apache conf is enabled.
Expand Down Expand Up @@ -64,7 +64,7 @@ def enable(name):
return ret


def disable(name):
def disabled(name):
'''
Ensure an Apache conf is disabled.
Expand Down
4 changes: 2 additions & 2 deletions salt/states/apache_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __virtual__():
return 'apache_module' if 'apache.a2enmod' in __salt__ else False


def enable(name):
def enabled(name):
'''
Ensure an Apache module is enabled.
Expand Down Expand Up @@ -61,7 +61,7 @@ def enable(name):
return ret


def disable(name):
def disabled(name):
'''
Ensure an Apache module is disabled.
Expand Down
4 changes: 2 additions & 2 deletions salt/states/apache_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __virtual__():
return 'apache_site' if 'apache.a2ensite' in __salt__ else False


def enable(name):
def enabled(name):
'''
Ensure an Apache site is enabled.
Expand Down Expand Up @@ -61,7 +61,7 @@ def enable(name):
return ret


def disable(name):
def disabled(name):
'''
Ensure an Apache site is disabled.
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/states/apache_conf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class ApacheConfTestCase(TestCase):
'''
Test cases for salt.states.apache_conf
'''
# 'enable' function tests: 1
# 'enabled' function tests: 1

def test_enable(self):
def test_enabled(self):
'''
Test to ensure an Apache conf is enabled.
'''
Expand All @@ -47,22 +47,22 @@ def test_enable(self):
'apache.a2enconf': mock_str}):
comt = ('{0} already enabled.'.format(name))
ret.update({'comment': comt})
self.assertDictEqual(apache_conf.enable(name), ret)
self.assertDictEqual(apache_conf.enabled(name), ret)

comt = ('Apache conf {0} is set to be enabled.'.format(name))
ret.update({'comment': comt, 'result': None,
'changes': {'new': name, 'old': None}})
with patch.dict(apache_conf.__opts__, {'test': True}):
self.assertDictEqual(apache_conf.enable(name), ret)
self.assertDictEqual(apache_conf.enabled(name), ret)

comt = ('Failed to enable {0} Apache conf'.format(name))
ret.update({'comment': comt, 'result': False, 'changes': {}})
with patch.dict(apache_conf.__opts__, {'test': False}):
self.assertDictEqual(apache_conf.enable(name), ret)
self.assertDictEqual(apache_conf.enabled(name), ret)

# 'disable' function tests: 1
# 'disabled' function tests: 1

def test_disable(self):
def test_disabled(self):
'''
Test to ensure an Apache conf is disabled.
'''
Expand All @@ -81,17 +81,17 @@ def test_disable(self):
comt = ('Apache conf {0} is set to be disabled.'.format(name))
ret.update({'comment': comt, 'changes': {'new': None, 'old': name}})
with patch.dict(apache_conf.__opts__, {'test': True}):
self.assertDictEqual(apache_conf.disable(name), ret)
self.assertDictEqual(apache_conf.disabled(name), ret)

comt = ('Failed to disable {0} Apache conf'.format(name))
ret.update({'comment': comt, 'result': False,
'changes': {}})
with patch.dict(apache_conf.__opts__, {'test': False}):
self.assertDictEqual(apache_conf.disable(name), ret)
self.assertDictEqual(apache_conf.disabled(name), ret)

comt = ('{0} already disabled.'.format(name))
ret.update({'comment': comt, 'result': True})
self.assertDictEqual(apache_conf.disable(name), ret)
self.assertDictEqual(apache_conf.disabled(name), ret)


if __name__ == '__main__':
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/states/apache_module_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class ApacheModuleTestCase(TestCase):
'''
Test cases for salt.states.apache_module
'''
# 'enable' function tests: 1
# 'enabled' function tests: 1

def test_enable(self):
def test_enabled(self):
'''
Test to ensure an Apache module is enabled.
'''
Expand All @@ -50,22 +50,22 @@ def test_enable(self):
'apache.a2enmod': mock_str}):
comt = ('{0} already enabled.'.format(name))
ret.update({'comment': comt})
self.assertDictEqual(apache_module.enable(name), ret)
self.assertDictEqual(apache_module.enabled(name), ret)

comt = ('Apache module {0} is set to be enabled.'.format(name))
ret.update({'comment': comt, 'result': None,
'changes': {'new': 'cgi', 'old': None}})
with patch.dict(apache_module.__opts__, {'test': True}):
self.assertDictEqual(apache_module.enable(name), ret)
self.assertDictEqual(apache_module.enabled(name), ret)

comt = ('Failed to enable {0} Apache module'.format(name))
ret.update({'comment': comt, 'result': False, 'changes': {}})
with patch.dict(apache_module.__opts__, {'test': False}):
self.assertDictEqual(apache_module.enable(name), ret)
self.assertDictEqual(apache_module.enabled(name), ret)

# 'disable' function tests: 1
# 'disabled' function tests: 1

def test_disable(self):
def test_disabled(self):
'''
Test to ensure an Apache module is disabled.
'''
Expand All @@ -84,17 +84,17 @@ def test_disable(self):
comt = ('Apache module {0} is set to be disabled.'.format(name))
ret.update({'comment': comt, 'changes': {'new': None, 'old': 'cgi'}})
with patch.dict(apache_module.__opts__, {'test': True}):
self.assertDictEqual(apache_module.disable(name), ret)
self.assertDictEqual(apache_module.disabled(name), ret)

comt = ('Failed to disable {0} Apache module'.format(name))
ret.update({'comment': comt, 'result': False,
'changes': {}})
with patch.dict(apache_module.__opts__, {'test': False}):
self.assertDictEqual(apache_module.disable(name), ret)
self.assertDictEqual(apache_module.disabled(name), ret)

comt = ('{0} already disabled.'.format(name))
ret.update({'comment': comt, 'result': True})
self.assertDictEqual(apache_module.disable(name), ret)
self.assertDictEqual(apache_module.disabled(name), ret)


if __name__ == '__main__':
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/states/apache_site_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class ApacheSiteTestCase(TestCase):
'''
Test cases for salt.states.apache_site
'''
# 'enable' function tests: 1
# 'enabled' function tests: 1

def test_enable(self):
def test_enabled(self):
'''
Test to ensure an Apache site is enabled.
'''
Expand All @@ -47,22 +47,22 @@ def test_enable(self):
'apache.a2ensite': mock_str}):
comt = ('{0} already enabled.'.format(name))
ret.update({'comment': comt})
self.assertDictEqual(apache_site.enable(name), ret)
self.assertDictEqual(apache_site.enabled(name), ret)

comt = ('Apache site {0} is set to be enabled.'.format(name))
ret.update({'comment': comt, 'result': None,
'changes': {'new': name, 'old': None}})
with patch.dict(apache_site.__opts__, {'test': True}):
self.assertDictEqual(apache_site.enable(name), ret)
self.assertDictEqual(apache_site.enabled(name), ret)

comt = ('Failed to enable {0} Apache site'.format(name))
ret.update({'comment': comt, 'result': False, 'changes': {}})
with patch.dict(apache_site.__opts__, {'test': False}):
self.assertDictEqual(apache_site.enable(name), ret)
self.assertDictEqual(apache_site.enabled(name), ret)

# 'disable' function tests: 1
# 'disabled' function tests: 1

def test_disable(self):
def test_disabled(self):
'''
Test to ensure an Apache site is disabled.
'''
Expand All @@ -81,17 +81,17 @@ def test_disable(self):
comt = ('Apache site {0} is set to be disabled.'.format(name))
ret.update({'comment': comt, 'changes': {'new': None, 'old': name}})
with patch.dict(apache_site.__opts__, {'test': True}):
self.assertDictEqual(apache_site.disable(name), ret)
self.assertDictEqual(apache_site.disabled(name), ret)

comt = ('Failed to disable {0} Apache site'.format(name))
ret.update({'comment': comt, 'result': False,
'changes': {}})
with patch.dict(apache_site.__opts__, {'test': False}):
self.assertDictEqual(apache_site.disable(name), ret)
self.assertDictEqual(apache_site.disabled(name), ret)

comt = ('{0} already disabled.'.format(name))
ret.update({'comment': comt, 'result': True})
self.assertDictEqual(apache_site.disable(name), ret)
self.assertDictEqual(apache_site.disabled(name), ret)


if __name__ == '__main__':
Expand Down

0 comments on commit f3a2b27

Please sign in to comment.