def processAccepted(self, distribution):
     """Run the process-accepted script."""
     self.logger.debug(
         "Processing the accepted queue into the publishing records...")
     script = ProcessAccepted(test_args=[distribution.name],
                              logger=self.logger)
     script.txn = self.txn
     script.main()
 def processAccepted(self, distribution):
     """Run the process-accepted script."""
     self.logger.debug(
         "Processing the accepted queue into the publishing records...")
     script = ProcessAccepted(
         test_args=[distribution.name], logger=self.logger)
     script.txn = self.txn
     script.main()
 def getScript(self, test_args=None):
     """Return a ProcessAccepted instance."""
     if test_args is None:
         test_args = []
     test_args.append(self.distro.name)
     script = ProcessAccepted("process accepted", test_args=test_args)
     script.logger = BufferLogger()
     script.txn = self.layer.txn
     return script
 def getScript(self, test_args=None):
     """Return a ProcessAccepted instance."""
     if test_args is None:
         test_args = []
     test_args.append(self.distro.name)
     script = ProcessAccepted("process accepted", test_args=test_args)
     script.logger = BufferLogger()
     script.txn = self.layer.txn
     return script
 def test_findTargetDistros_for_derived_finds_derived_distro(self):
     dsp = self.factory.makeDistroSeriesParent()
     script = ProcessAccepted(test_args=['--derived'])
     self.assertIn(dsp.derived_series.distribution,
                   script.findTargetDistros())
 def test_findNamedDistro_raises_error_if_not_found(self):
     nonexistent_distro = self.factory.getUniqueString()
     script = ProcessAccepted(test_args=[nonexistent_distro])
     self.assertRaises(LaunchpadScriptFailure, script.findNamedDistro,
                       nonexistent_distro)
 def test_findTargetDistros_finds_named_distro(self):
     distro = self.factory.makeDistribution()
     script = ProcessAccepted(test_args=[distro.name])
     self.assertContentEqual([distro], script.findTargetDistros())
 def test_validateArguments_does_not_accept_distro_for_derived_run(self):
     distro = self.factory.makeDistribution()
     script = ProcessAccepted(test_args=['--derived', distro.name])
     self.assertRaises(OptionValueError, script.validateArguments)
 def test_validateArguments_requires_no_distro_for_derived_run(self):
     ProcessAccepted(test_args=['--derived']).validateArguments()
     # The test is that this does not raise an exception.
     pass
 def test_validateArguments_requires_distro_by_default(self):
     self.assertRaises(OptionValueError,
                       ProcessAccepted(test_args=[]).validateArguments)
#!/usr/bin/python -S
#
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Queue/Accepted processor

Given a distribution to run on, obtains all the queue items for the
distribution and then gets on and deals with any accepted items, preparing
them for publishing as appropriate.
"""

import _pythonpath

from lp.soyuz.scripts.processaccepted import ProcessAccepted


if __name__ == '__main__':
    script = ProcessAccepted(
        "process-accepted", dbuser='******')
    script.lock_and_run()
 def test_findTargetDistros_for_derived_finds_derived_distro(self):
     dsp = self.factory.makeDistroSeriesParent()
     script = ProcessAccepted(test_args=['--derived'])
     self.assertIn(
         dsp.derived_series.distribution, script.findTargetDistros())
 def test_findTargetDistros_finds_named_distro(self):
     distro = self.factory.makeDistribution()
     script = ProcessAccepted(test_args=[distro.name])
     self.assertContentEqual([distro], script.findTargetDistros())