def setUp(self): self.addCleanup(mock.patch.stopall) self.exists_mock = mock.patch.object(os.path, 'exists').start() self.getcwd_mock = mock.patch.object(os, 'getcwd').start() self.getcwd_mock.return_value = '/tmp/rootdir' self.open_mock = (mock.patch.object(nom_build, 'open', self.open_fake).start()) self.print_mock = (mock.patch.object(nom_build, 'print', self.print_fake).start()) self.call_mock = mock.patch.object(subprocess, 'call').start() self.file_contents = { # Prefil with the actual file contents. PROPERTIES_FILENAME: nom_build.generate_gradle_properties() } self.printed = []
def test_property_generation(self): self.assertEqual(nom_build.generate_gradle_properties(), FAKE_PROP_CONTENTS)