This repository has been archived by the owner on Mar 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from jmtd/test-change-processor
test change processor handling of ints
- Loading branch information
Showing
3 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Copyright (c) 2015 Red Hat, Inc | ||
All rights reserved. | ||
This software may be modified and distributed under the terms | ||
of the MIT license. See the LICENSE file for details. | ||
""" | ||
|
||
import logging | ||
|
||
from cct.module import Module | ||
|
||
logger = logging.getLogger('cct') | ||
|
||
class Dummy(Module): | ||
def dump(self, *args): | ||
""" | ||
Dumps arguments to a logfile. | ||
Args: | ||
*args: Will be dumped :). | ||
""" | ||
logger.info("dummy module performed dump with args %s and environment: %s" % (args, self.environment )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
Copyright (c) 2015 Red Hat, Inc | ||
All rights reserved. | ||
This software may be modified and distributed under the terms | ||
of the MIT license. See the LICENSE file for details. | ||
""" | ||
|
||
import os | ||
import unittest | ||
import mock | ||
|
||
from cct.change_processor import ChangeProcessor | ||
|
||
class TestModule(unittest.TestCase): | ||
def setUp(self): | ||
os.environ['CCT_MODULES_PATH'] = 'tests/modules' | ||
|
||
def test_process_string_values(self): | ||
""" | ||
Make sure that changes that have string values are accepted | ||
""" | ||
config = [{ | ||
'changes': [{'dummy.Dummy': [{'dump': '493'}]}], | ||
'name': 'dummy' | ||
}] | ||
changerunner = ChangeProcessor(config) | ||
changerunner.process() | ||
|
||
|
||
def test_process_int_values(self): | ||
""" | ||
Make sure that changes that have integer values are accepted | ||
""" | ||
config = [{ | ||
'changes': [{'dummy.Dummy': [{'dump': 493}]}], | ||
'name': 'dummy' | ||
}] | ||
changerunner = ChangeProcessor(config) | ||
changerunner.process() | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |