def test_packager_context_setup_spec(self, mkdtemp, copy): with patch('rpmbuild.open', self.open, create=True): context = PackagerContext('foo', spec='foo.spec') context.template.render = MagicMock() context.setup() copy.assert_called_with('foo.spec', '/context') self.context_defaults.update(image='foo', spec='foo.spec') context.template.render.assert_called_with(**self.context_defaults)
def test_packager_context_teardown(self, mkdtemp, copy, rmtree): with patch('rpmbuild.open', self.open, create=True): context = PackagerContext('foo', spec='foo.spec') context.setup() context.teardown() rmtree.assert_called_with('/context')
def test_packager_context_setup_srpm(self, mkdtemp, copy): with patch('rpmbuild.open', self.open, create=True): context = PackagerContext('foo', srpm='foo.srpm') context.setup() copy.assert_called_with('foo.srpm', '/context')
def test_packager_context_setup_spec_sources_dir(self, mkdtemp, copy, copytree): with patch('rpmbuild.open', self.open, create=True): context = PackagerContext('foo', spec='foo.spec', sources_dir='/tmp') context.setup() copy.assert_called_with('foo.spec', '/context') copytree.assert_called_with('/tmp', '/context/SOURCES')
def test_packager_context_setup_sources(self, mkdtemp, copy): with patch('rpmbuild.open', self.open, create=True): context = PackagerContext('foo', sources=['foo.tar.gz']) context.setup() copy.assert_called_with('foo.tar.gz', '/context')
def test_packager_context_setup_macrofiles(self, mkdtemp, copy): with patch('rpmbuild.open', self.open, create=True): context = PackagerContext('foo', macrofiles=['foo.macro'], spec='foo.spec') context.setup() copy.assert_any_call('foo.macro', '/context')