Created
August 26, 2016 16:12
-
-
Save hiraq/d7f77d1ba9e218317ba9a7ecb2f12555 to your computer and use it in GitHub Desktop.
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
import unittest | |
import mock | |
from module.my_class_a import MyClassA | |
class TestMyClassA(unittest.TestCase): | |
def setUp(self): | |
self._fake_path = '/path/to/the/fake/yaml/file' | |
@mock.patch('module.my_class_a.yaml') | |
def test_to_test(self, mock_yaml): | |
mock_yaml.load = mock.MagicMock() | |
mock_yaml.load.return_value = dict(test='testing') | |
a = MyClassA() | |
output = a.to_test(self._fake_path) | |
self.assertEqual('testing', output['test']) | |
mock_yaml.load.assert_called_with() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment