def distributionSourcePackageSetUp(test): """Setup the `IDistributionSourcePackage` test.""" setUp(test) ubuntu = getUtility(IDistributionSet).getByName('ubuntu') test.globs['bugtarget'] = ubuntu.getSourcePackage('mozilla-firefox') test.globs['filebug'] = bugtarget_filebug test.globs['question_target'] = test.globs['bugtarget']
def distributionSeriesSetUp(test): """Setup the `IDistroSeries` test.""" setUp(test) ubuntu = getUtility(IDistributionSet).getByName('ubuntu') test.globs['bugtarget'] = ubuntu.getSeries('hoary') test.globs['filebug'] = distroseries_filebug test.globs['question_target'] = ubuntu
def productSeriesSetUp(test): """Setup the `IProductSeries` test.""" setUp(test) firefox = getUtility(IProductSet).getByName('firefox') test.globs['bugtarget'] = firefox.getSeries('trunk') test.globs['filebug'] = productseries_filebug test.globs['question_target'] = firefox
def sourcePackageSetUp(test): """Setup the `ISourcePackage` test.""" setUp(test) ubuntu = getUtility(IDistributionSet).getByName('ubuntu') warty = ubuntu.getSeries('warty') test.globs['bugtarget'] = warty.getSourcePackage('mozilla-firefox') test.globs['filebug'] = sourcepackage_filebug test.globs['question_target'] = ubuntu.getSourcePackage('mozilla-firefox')
def productSetUp(test): """Test environment for product.""" setUp(test) thunderbird = getUtility(IProductSet).getByName('thunderbird') test.globs['target'] = thunderbird test.globs['collection'] = thunderbird login('*****@*****.**') test.globs['newFAQ'] = thunderbird.newFAQ login(ANONYMOUS)
def distributionSetUp(test): """Test environment for distribution.""" setUp(test) kubuntu = getUtility(IDistributionSet).getByName('kubuntu') test.globs['target'] = kubuntu test.globs['collection'] = kubuntu login('*****@*****.**') test.globs['newFAQ'] = kubuntu.newFAQ login(ANONYMOUS)
def bugLinkedToQuestionSetUp(test): """Setup the question and linked bug for testing.""" def get_bugtask_linked_to_question(): return getUtility(IBugTaskSet).get(bugtask_id) setUp(test) bugtask_id = _createUbuntuBugTaskLinkedToQuestion() test.globs["get_bugtask_linked_to_question"] = get_bugtask_linked_to_question # Log in here, since we don't want to set up an non-anonymous # interaction in the test. login("*****@*****.**")
def bugLinkedToQuestionSetUp(test): """Setup the question and linked bug for testing.""" def get_bugtask_linked_to_question(): return getUtility(IBugTaskSet).get(bugtask_id) setUp(test) bugtask_id = _createUbuntuBugTaskLinkedToQuestion() test.globs['get_bugtask_linked_to_question'] = ( get_bugtask_linked_to_question) # Log in here, since we don't want to set up an non-anonymous # interaction in the test. login('*****@*****.**')
def uploaderBugsSetUp(test): """Set up a test suite using the 'uploader' db user. Some aspects of the bug tracker are being used by the Soyuz uploader. In order to test that these functions work as expected from the uploader, we run them using the same db user used by the uploader. """ lobotomize_stevea() test_dbuser = config.uploader.dbuser switch_dbuser(test_dbuser) setUp(test) test.globs['test_dbuser'] = test_dbuser
def projectSetUp(test): """Test environment for project.""" setUp(test) gnome_project = getUtility(IProjectGroupSet).getByName('gnome') products_queue = list(gnome_project.products) def newFAQ(owner, title, content, keywords=None, date_created=None): """Create a new FAQ on each project's product in turn.""" product = products_queue.pop(0) products_queue.append(product) return product.newFAQ( owner, title, content, keywords=keywords, date_created=date_created) test.globs['collection'] = gnome_project test.globs['newFAQ'] = newFAQ
def test_suite(): suite = unittest.TestSuite() loader = unittest.TestLoader() suite.addTest(loader.loadTestsFromTestCase(TestEmailObfuscated)) suite.addTest( LayeredDocFileSuite('question-subscribe_me.txt', setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=DatabaseFunctionalLayer)) suite.addTest( LayeredDocFileSuite('views.txt', setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=DatabaseFunctionalLayer)) suite.addTest( LayeredDocFileSuite('faq-views.txt', setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=DatabaseFunctionalLayer)) return suite
def test_suite(): suite = unittest.TestSuite() suite.addTest( LayeredDocFileSuite('bugzilla-xmlrpc-transport.txt', setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=LaunchpadFunctionalLayer)) suite.addTest( LayeredDocFileSuite('bugzilla-api-xmlrpc-transport.txt', setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=LaunchpadFunctionalLayer)) suite.addTest( LayeredDocFileSuite('trac-xmlrpc-transport.txt', setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=LaunchpadFunctionalLayer)) suite.addTest( LayeredDocFileSuite('externalbugtracker-xmlrpc-transport.txt', setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=LaunchpadFunctionalLayer)) return suite
def test_suite(): suite = unittest.TestSuite() stories_dir = os.path.join(os.path.pardir, 'stories') suite.addTest( PageTestSuite(stories_dir, setUp=lambda test: setUpGlobs(test, future=True))) stories_path = os.path.join(here, stories_dir) for story_entry in scandir.scandir(stories_path): if not story_entry.is_dir(): continue story_path = os.path.join(stories_dir, story_entry.name) suite.addTest( PageTestSuite(story_path, setUp=lambda test: setUpGlobs(test, future=True))) testsdir = os.path.abspath( os.path.normpath(os.path.join(here, os.path.pardir, 'doc'))) # Add special needs tests for key in sorted(special): special_suite = special[key] suite.addTest(special_suite) # Add tests using default setup/teardown filenames = [ filename for filename in os.listdir(testsdir) if filename.endswith('.txt') and filename not in special ] # Sort the list to give a predictable order. filenames.sort() for filename in filenames: path = os.path.join('../doc/', filename) one_test = LayeredDocFileSuite( path, setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=LaunchpadFunctionalLayer, stdout_logging_level=logging.WARNING) suite.addTest(one_test) return suite
def test_suite(): suite = unittest.TestSuite() testsdir = os.path.abspath(here) # Add tests using default setup/teardown filenames = [filename for filename in os.listdir(testsdir) if filename.endswith('.txt')] # Sort the list to give a predictable order. filenames.sort() for filename in filenames: path = filename one_test = LayeredDocFileSuite( path, setUp=lambda test: setUp(test, future=True), tearDown=tearDown, layer=LaunchpadFunctionalLayer, stdout_logging_level=logging.WARNING) suite.addTest(one_test) return suite
def bugtaskExpirationSetUp(test): """Setup globs for bug expiration.""" setUp(test) login("*****@*****.**")
def noPrivSetUp(test): """Set up a test logged in as no-priv.""" setUp(test) login("*****@*****.**")
def cveSetUp(test): lobotomize_stevea() switch_dbuser(config.cveupdater.dbuser) setUp(test)
def distroSeriesSourcePackageSetUp(test): setUp(test) test.globs['target'] = ( getUtility(IDistributionSet).getByName('ubuntu').getSeries('hoary')) test.globs['filebug'] = distroseries_sourcepackage_filebug
def milestoneSetUp(test): setUp(test) firefox = getUtility(IProductSet).getByName('firefox') test.globs['target'] = firefox.getMilestone('1.0') test.globs['filebug'] = milestone_filebug
def distributionSetUp(test): setUp(test) test.globs['target'] = getUtility(IDistributionSet).getByName('ubuntu') test.globs['filebug'] = bugtarget_filebug
def productSetUp(test): setUp(test) test.globs['target'] = getUtility(IProductSet).getByName('firefox') test.globs['filebug'] = bugtarget_filebug
def distributionSourcePackageSetUp(test): setUp(test) ubuntu = getUtility(IDistributionSet).getByName('ubuntu') test.globs['target'] = ubuntu.getSourcePackage('evolution') test.globs['other_target'] = ubuntu.getSourcePackage('pmount') test.globs['filebug'] = bugtarget_filebug
def updateRemoteProductSetup(test): """Setup to use the 'updateremoteproduct' db user.""" setUp(test) switch_dbuser(config.updateremoteproduct.dbuser)
def statisticianSetUp(test): test_dbuser = config.statistician.dbuser test.globs['test_dbuser'] = test_dbuser switch_dbuser(test_dbuser) setUp(test)
def distributionSetUp(test): """Setup the `IDistribution` test.""" setUp(test) test.globs['bugtarget'] = getUtility(IDistributionSet).getByName('ubuntu') test.globs['filebug'] = bugtarget_filebug test.globs['question_target'] = test.globs['bugtarget']
def uploaderSetUp(test): """setup the package uploader script tests.""" setUp(test) switch_dbuser('uploader')
def projectSetUp(test): """Setup the `IProjectGroup` test.""" setUp(test) projectgroups = getUtility(IProjectGroupSet) test.globs['bugtarget'] = projectgroups.getByName('mozilla') test.globs['filebug'] = project_filebug
def uploadQueueSetUp(test): lobotomize_stevea() test_dbuser = config.uploadqueue.dbuser switch_dbuser(test_dbuser) setUp(test) test.globs['test_dbuser'] = test_dbuser
def checkwatchesSetUp(test): """Setup the check watches script tests.""" setUp(test) switch_dbuser(config.checkwatches.dbuser)
def branchscannerSetUp(test): """Setup the user for the branch scanner tests.""" switch_dbuser("branchscanner") setUp(test)
def bugNotificationSendingSetUp(test): lobotomize_stevea() switch_dbuser(config.malone.bugnotification_dbuser) setUp(test)
def bugSetStatusSetUp(test): setUp(test) test.globs["test_dbuser"] = config.processmail.dbuser
def productSetUp(test): """Setup the `IProduct` test.""" setUp(test) test.globs['bugtarget'] = getUtility(IProductSet).getByName('firefox') test.globs['filebug'] = bugtarget_filebug test.globs['question_target'] = test.globs['bugtarget']
def bugmessageSetUp(test): setUp(test) login("*****@*****.**")
def hwdbDeviceTablesSetup(test): setUp(test) switch_dbuser('hwdb-submission-processor')
def lobotomizeSteveASetUp(test): """Call lobotomize_stevea() and standard setUp""" lobotomize_stevea() setUp(test)