示例#1
0
    def setUp(self):
        self.working_dir = tempfile.mkdtemp(prefix='working_')
        self.published_dir = tempfile.mkdtemp(prefix='published_')
        self.master_dir = os.path.join(self.published_dir, 'master')

        self.repo_id = 'publish-test-repo'
        self.repo = Repository(self.repo_id, working_dir=self.working_dir)
        self.conduit = Mock()
        self.conduit = RepoPublishConduit(self.repo_id, 'test_distributor_id')
        self.conduit.get_repo_scratchpad = Mock(return_value={})

        self.config = PluginCallConfiguration(None, None)
        self.publisher = publish_step.PublishStep(
            "base-step", repo=self.repo, publish_conduit=self.conduit,
            config=self.config, distributor_type='test_distributor_type')
示例#2
0
 def test_publish(self):
     # just test that process_lifecycle got called, that is where the functionality lives now
     step = publish_step.PublishStep("foo")
     step.process_lifecycle = Mock()
     step.publish()
     self.assertTrue(step.process_lifecycle.called)
示例#3
0
    def test_clear_directory(self, mock_clear):
        step = publish_step.PublishStep("foo")

        step._clear_directory(self.working_dir, ['two'])
        mock_clear.assert_called_once_with(self.working_dir, ['two'])
示例#4
0
 def test_create_symlink(self, mock_symlink):
     step = publish_step.PublishStep("foo")
     step._create_symlink('foo', 'bar')
     mock_symlink.assert_called_once_with('foo', 'bar')
示例#5
0
 def test_get_distributor_type_from_parent(self):
     step = publish_step.PublishStep('foo_step')
     step.conduit = 'foo'
     step.parent = Mock()
     step.parent.get_plugin_type.return_value = 'foo'
     self.assertEquals('foo', step.get_distributor_type())
示例#6
0
 def test_get_distributor_type_none(self):
     step = publish_step.PublishStep('foo_step')
     self.assertEquals(None, step.get_distributor_type())
示例#7
0
 def test_get_distributor_type(self):
     step = publish_step.PublishStep('foo_step')
     step.plugin_type = 'foo'
     self.assertEquals('foo', step.get_distributor_type())
示例#8
0
 def test_clear_children(self):
     step = publish_step.PublishStep("foo")
     step.children = ['bar']
     step.clear_children()
     self.assertEquals(0, len(step.children))