def testGlobalsSetup(test):
    """Inject useful helper functions in tests globals.

    We can use the getUpload* without unnecessary imports.
    """
    import_public_test_keys()
    setGlobs(test)
    test.globs['getUploadForSource'] = getUploadForSource
    test.globs['getUploadForBinary'] = getUploadForBinary
    test.globs['getPPAUploadForSource'] = getPPAUploadForSource
def buildmasterSetUp(test):
    """Setup a typical builddmaster test environment.

    Log in as ANONYMOUS and perform DB operations as the builddmaster
    dbuser.
    """
    test_dbuser = config.builddmaster.dbuser
    login(ANONYMOUS)
    setGlobs(test)
    test.globs['test_dbuser'] = test_dbuser
    switch_dbuser(test_dbuser)
예제 #3
0
def zopelessLaunchpadSecuritySetUp(test):
    """Set up a LaunchpadZopelessLayer test to use LaunchpadSecurityPolicy.

    To be able to use switch_dbuser in a test, we need to run in the
    Zopeless environment. The Zopeless environment normally runs using the
    LaunchpadPermissiveSecurityPolicy. If we want the test to cover
    functionality used in the webapp, it needs to use the
    LaunchpadSecurityPolicy.
    """
    setGlobs(test)
    test.old_security_policy = setSecurityPolicy(LaunchpadSecurityPolicy)
def buildmasterSetUp(test):
    """Setup a typical builddmaster test environment.

    Log in as ANONYMOUS and perform DB operations as the builddmaster
    dbuser.
    """
    test_dbuser = config.builddmaster.dbuser
    login(ANONYMOUS)
    setGlobs(test)
    test.globs['test_dbuser'] = test_dbuser
    switch_dbuser(test_dbuser)
예제 #5
0
def zopelessLaunchpadSecuritySetUp(test):
    """Set up a LaunchpadZopelessLayer test to use LaunchpadSecurityPolicy.

    To be able to use switch_dbuser in a test, we need to run in the
    Zopeless environment. The Zopeless environment normally runs using the
    LaunchpadPermissiveSecurityPolicy. If we want the test to cover
    functionality used in the webapp, it needs to use the
    LaunchpadSecurityPolicy.
    """
    setGlobs(test)
    test.old_security_policy = setSecurityPolicy(LaunchpadSecurityPolicy)
예제 #6
0
        '../doc/translationimportqueue.txt',
        setUp=lambda test: setUp(test, future=True),
        tearDown=tearDown,
        layer=LaunchpadFunctionalLayer,
    ),
    'rosetta-karma.txt':
    LayeredDocFileSuite(
        '../doc/rosetta-karma.txt',
        setUp=lambda test: setUp(test, future=True),
        tearDown=tearDown,
        layer=LaunchpadFunctionalLayer,
    ),
    'translationmessage-destroy.txt':
    LayeredDocFileSuite(
        '../doc/translationmessage-destroy.txt',
        setUp=lambda test: setGlobs(test, future=True),
        layer=LaunchpadZopelessLayer,
    ),
    'translationsoverview.txt':
    LayeredDocFileSuite(
        '../doc/translationsoverview.txt',
        setUp=lambda test: setGlobs(test, future=True),
        layer=LaunchpadZopelessLayer,
    ),
}


def test_suite():
    suite = unittest.TestSuite()

    stories_dir = os.path.join(os.path.pardir, 'stories')