# -*- test-case-name: xmantissa.test.historic.test_ampConfiguration1to2 -*-
# Copyright 2008 Divmod, Inc. See LICENSE file for details

"""
Generate a stub for the tests for the upgrade from schema version 1 to 2 of the
AMPConfiguration item.
"""

from axiom.dependency import installOn
from axiom.test.historic.stubloader import saveStub

from xmantissa.ampserver import AMPConfiguration


def createDatabase(store):
    """
    Make an L{AMPConfiguration} in the given store.
    """
    installOn(AMPConfiguration(store=store), store)


if __name__ == '__main__':
    saveStub(createDatabase, 16892)
from xmantissa import prefs


def createDatabase(s):
    prefs.DefaultPreferenceCollection(store=s)


from axiom.test.historic.stubloader import saveStub

if __name__ == '__main__':
    saveStub(createDatabase)
from axiom.test.historic.stubloader import saveStub
from xquotient.grabber import GrabberConfiguration

def createDatabase(s):
    GrabberConfiguration(store=s)

if __name__ == '__main__':
    saveStub(createDatabase, 10876)
Beispiel #4
0
class Dummy(Item):
    typeName = 'axiom_storeid_dummy'
    schemaVersion = 1

    attribute = text(doc='text', allowNone=False)


class Dummy2(Item):
    typeName = 'axiom_storeid_dummy2'
    schemaVersion = 1

    attribute = text(doc='text', allowNone=False)


def createDatabase(s):
    """
    Populate the given Store with some Dummy items.
    """
    Dummy(store=s, attribute=u'one')
    Dummy(store=s, attribute=u'two')
    i = Dummy(store=s, attribute=u'three')
    Dummy2(store=s, attribute=u'four')
    # Work around https://github.com/twisted/axiom/issues/86
    i.checkpoint()
    i.deleteFromStore()


if __name__ == '__main__':
    saveStub(createDatabase, 0x1240846306fcda3289550cdf9515b2c7111d2bac)
from xquotient.spam import SpambayesFilter

SPAM_A = ["spam", "bad"]
SPAM_B = ["junk", "evil"]
HAM = ["ham", "good", "wonderful", "justice"]
AMBIGUOUS = "ambiguous"


class Document(object):
    def __init__(self, text):
        self.impl = self
        self.source = self
        self.text = text


    def open(self):
        return StringIO(self.text)



def createDatabase(s):
    bayes = SpambayesFilter(store=s)
    installOn(bayes, s)
    bayes.train(True, Document(" ".join(SPAM_A)))
    bayes.train(True, Document(" ".join(SPAM_B + [AMBIGUOUS])))
    bayes.train(False, Document(" ".join(HAM + [AMBIGUOUS])))


if __name__ == '__main__':
    saveStub(createDatabase, '[email protected]')
# -*- test-case-name: xmantissa.test.historic.test_userinfo1to2 -*-

"""
Create the stub database for the test for the UserInfo schema version 1 to 2
upgrader.
"""

from axiom.test.historic.stubloader import saveStub

from xmantissa.signup import UserInfo

FIRST = u'Alice'
LAST = u'Smith'

def createDatabase(store):
    """
    Create a version 1 L{UserInfo} item in the given store.
    """
    UserInfo(store=store, firstName=FIRST, lastName=LAST)


if __name__ == '__main__':
    saveStub(createDatabase, 13447)
Beispiel #7
0
# -*- test-case-name: xquotient.test.historic.test_inbox3to4 -*-

"""
Create a stub database for upgrade of L{xquotient.inbox.Inbox} from version 3
to version 4.
"""

from axiom.test.historic.stubloader import saveStub
from axiom import scheduler
from xmantissa import website, webapp
from xquotient.quotientapp import QuotientPreferenceCollection, MessageDisplayPreferenceCollection
from xquotient import inbox, mail

def createDatabase(s):
    s.findOrCreate(scheduler.SubScheduler).installOn(s)
    s.findOrCreate(website.WebSite).installOn(s)
    s.findOrCreate(webapp.PrivateApplication).installOn(s)

    s.findOrCreate(mail.DeliveryAgent).installOn(s)

    s.findOrCreate(mail.MessageSource)

    s.findOrCreate(QuotientPreferenceCollection).installOn(s)
    s.findOrCreate(MessageDisplayPreferenceCollection).installOn(s)
    s.findOrCreate(inbox.Inbox, uiComplexity=2, showMoreDetail=True).installOn(s)

if __name__ == '__main__':
    saveStub(createDatabase, 11096)
# -*- test-case-name: xmantissa.test.historic.test_searchresult1to2 -*-

from axiom.test.historic.stubloader import saveStub

from xmantissa.search import SearchResult


def createDatabase(s):
    SearchResult(store=s, indexedItem=s, identifier=0)


if __name__ == "__main__":
    saveStub(createDatabase, 7976)
"""
Generate a stub for the tests for the deletion of the RealName item.
"""

from axiom.test.historic.stubloader import saveStub

from xmantissa.people import Person, RealName


def createDatabase(store):
    """
    Make a L{Person} with a corresponding L{RealName} which will be deleted.
    """
    person = Person(store=store)
    name = RealName(store=store, person=person)


if __name__ == '__main__':
    saveStub(createDatabase, 13508)
from axiom.test.historic.stubloader import saveStub

from epsilon.extime import Time

from xquotient.exmess import Message
from xquotient.mimestorage import Part

from xquotient.test.historic.stub_message1to2 import attrs

def createDatabase(s):
    Message(store=s,
            impl=Part(store=s),
            **attrs)

if __name__ == '__main__':
    saveStub(createDatabase, 7212)
# -*- test-case-name: xquotient.test.historic.test_filter1to2 -*-

from axiom.test.historic.stubloader import saveStub
from axiom.scheduler import Scheduler

from xquotient.mail import MessageSource
from xquotient.spam import Filter


def createDatabase(s):
    Scheduler(store=s).installOn(s)
    MessageSource(store=s)
    Filter(store=s).installOn(s)


if __name__ == '__main__':
    saveStub(createDatabase, 8041)
# -*- test-case-name xquotient.test.test_historic.test_composer2to3 -*-

"""
Create stub database for upgrade of L{xquotient.compose.Composer} from
version 3 to version 4.
"""

from axiom.test.historic.stubloader import saveStub
from axiom.userbase import LoginMethod

from xquotient.compose import Composer

def createDatabase(s):
    """
    Install a Composer on the given store.
    """
    LoginMethod(store=s,
                localpart=u'foo',
                domain=u'bar',
                verified=True,
                protocol=u'*',
                account=s,
                internal=False)
    Composer(store=s).installOn(s)



if __name__ == '__main__':
    saveStub(createDatabase, 10556)
------=_NextPart_000_0085_01C7B397.EB1676A0
Content-Type: image/jpeg;
        name="image-1.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
        filename="image-1.jpg"

some jpeg stuff I don't know really

------=_NextPart_000_0085_01C7B397.EB1676A0--



--------------000701040003040406010604--
"""

def createDatabase(s):
    installOn(SubScheduler(store=s), s)
    mms = IncomingMIMEMessageStorer(
        s, s.newFile("mail", "1.eml"),
        u'migration://migration')
    for line in msg.splitlines():
        mms.lineReceived(line)
    mms.messageDone()

    assert len(list(mms.message.impl.walk())) == 3

if __name__ == '__main__':
    saveStub(createDatabase, 12949)
Beispiel #14
0
"""
Generate a stub for the tests for the upgrade from schema version 2 to 3 of the
Person item.
"""

from epsilon.extime import Time

from axiom.test.historic.stubloader import saveStub

from xmantissa.people import Organizer, Person

NAME = u'Test User'
CREATED = Time.fromPOSIXTimestamp(1234567890)

def createDatabase(store):
    """
    Make a L{Person} in the given store.
    """
    organizer = Organizer(store=store)
    person = Person(
        store=store,
        organizer=organizer,
        name=NAME)
    person.created = CREATED


if __name__ == '__main__':
    saveStub(createDatabase, 13344)
Beispiel #15
0
# -*- test-case-name xquotient.test.test_historic.test_composePreferenceCollection2to3 -*-
"""
Create stub database for upgrade of
L{xquotient.compose.ComposePreferenceCollection} from version 2 to version 3.
"""

from axiom.test.historic.stubloader import saveStub
from axiom.userbase import LoginMethod

from xquotient.compose import ComposePreferenceCollection, Composer


def createDatabase(s):
    """
    Install a Composer and ComposePreferenceCollection on the given store.
    """
    LoginMethod(store=s,
                localpart=u'foo',
                domain=u'bar',
                verified=True,
                protocol=u'*',
                account=s,
                internal=False)

    Composer(store=s).installOn(s)
    ComposePreferenceCollection(store=s).installOn(s)


if __name__ == '__main__':
    saveStub(createDatabase, 9237)
    """
    typeName = "stub_undefertask_fake_scheduler"

    ignored = integer()

    implements(IScheduler)

    def schedule(self, runnable, when):
        SCHEDULE_LOG.append(('schedule', runnable))

    def unscheduleAll(self, runnable):
        SCHEDULE_LOG.append(('unschedule', runnable))


def createDatabase(s):
    """
    Populate the given Store with a deferred message.
    """
    messageData = DummyMessageImplementation(store=s)
    fakeScheduler = FakeScheduler(store=s)
    s.powerUp(fakeScheduler, IScheduler)
    m = Message.createIncoming(s, messageData, u'test')
    m.classifyClean()
    m.markRead()
    now = Time()
    m.deferFor(timedelta(days=1), timeFactory=lambda: now)


if __name__ == '__main__':
    saveStub(createDatabase, 10588)
# -*- test-case-name: xquotient.test.historic.test_needsDelivery2to3 -*-
"""
Create stub database for upgrade of L{xquotient.compose._NeedsDelivery}
version 2 to L{xquotient.smtpout.DeliveryToAddress} version 3.
"""

from axiom.test.historic.stubloader import saveStub

from xquotient.compose import _NeedsDelivery, Composer


def createDatabase(s):
    """
    Install a _NeedsDelivery and Composer on the given store.
    """
    _NeedsDelivery(store=s,
                   composer=Composer(store=s),
                   message=s,
                   toAddress=u'to@host',
                   tries=21)


if __name__ == '__main__':
    saveStub(createDatabase, 10713)
Beispiel #18
0
# -*- test-case-name: xquotient.test.historic.test_drafts1to2 -*-

"""
Create stub database for upgrade of L{xquotient.compose.Drafts} from version 1
to version 2.
"""


from axiom.test.historic.stubloader import saveStub

from xquotient.compose import Composer, Drafts


def createDatabase(s):
    """
    Add a Drafts item to the store.
    """
    c = Composer(store=s)
    Drafts(store=s, installedOn=c)
    c.installed()


if __name__ == '__main__':
    saveStub(createDatabase, 10914)
Beispiel #19
0
from axiom.test.historic.stubloader import saveStub

from epsilon.extime import Time

from xquotient.exmess import Message
from xquotient.mimestorage import Part

attrs = dict(sender=u'*****@*****.**',
             subject=u'This is a spam',
             recipient=u'*****@*****.**',
             senderDisplay=u'Spammer',
             spam=True,
             archived=False,
             trash=True,
             outgoing=False,
             draft=False,
             trained=True,
             read=True,
             attachments=23,
             sentWhen=Time.fromPOSIXTimestamp(123),
             receivedWhen=Time.fromPOSIXTimestamp(456))

def createDatabase(s):
    Message(store=s,
            impl=Part(store=s),
            **attrs)

if __name__ == '__main__':
    saveStub(createDatabase, 7105)
# -*- test-case-name: xmantissa.test.historic.test_remoteIndexer2to3 -*-

from axiom.test.historic.stubloader import saveStub

from xmantissa.fulltext import HypeIndexer, XapianIndexer, PyLuceneIndexer
from xmantissa.test.test_fulltext import FakeMessageSource

def createDatabase(s):
    """
    Create a several indexers in the given store and hook them each up to a
    dummy message source.
    """
    source = FakeMessageSource(store=s)
    for cls in [HypeIndexer, XapianIndexer, PyLuceneIndexer]:
        indexer = cls(store=s)
        indexer.addSource(source)


if __name__ == '__main__':
    saveStub(createDatabase, 8029)
# -*- test-case-name: xmantissa.test.historic.test_searchresult1to2 -*-

from axiom.test.historic.stubloader import saveStub

from xmantissa.search import SearchResult


def createDatabase(s):
    SearchResult(store=s, indexedItem=s, identifier=0)


if __name__ == '__main__':
    saveStub(createDatabase, 7976)
# -*- test-case-name: xquotient.test.historic.test_filter3to4 -*-

"""
Stub database generator for version 3 of L{Filter}.
"""

from axiom.test.historic.stubloader import saveStub
from axiom.dependency import installOn

from xquotient.spam import Filter

USE_POSTINI_SCORE = True
POSTINI_THRESHHOLD = 0.5


def createDatabase(store):
    installOn(
        Filter(store=store, usePostiniScore=USE_POSTINI_SCORE,
               postiniThreshhold=POSTINI_THRESHHOLD),
        store)


if __name__ == '__main__':
    saveStub(createDatabase, 17723)
Beispiel #23
0
from twisted.python.filepath import FilePath

from axiom.test.historic.stubloader import saveStub
from xmantissa.fulltext import PyLuceneIndexer


def createDatabase(s):
    PyLuceneIndexer(store=s,
                    installedOn=s,
                    indexCount=23,
                    indexDirectory=u'foo.index').installOn(s)


if __name__ == '__main__':
    saveStub(createDatabase, 9044)
from hyperbola.hyperbola_model import HyperbolaPublicPresence


def createDatabase(s):
    s.findOrCreate(HyperbolaPublicPresence)


from axiom.test.historic.stubloader import saveStub

if __name__ == '__main__':
    saveStub(createDatabase, 11596)
Beispiel #25
0
# -*- test-case-name: axiom.test.historic.test_manhole1to2 -*-
# Copyright 2008 Divmod, Inc.  See LICENSE for details.

from axiom.dependency import installOn
from axiom.batch import BatchManholePowerup
from axiom.test.historic.stubloader import saveStub


def createDatabase(store):
    installOn(BatchManholePowerup(store=store), store)


if __name__ == "__main__":
    saveStub(createDatabase, 16829)
from axiom.test.historic.stubloader import saveStub

from axiom.scheduler import Scheduler, SubScheduler
from axiom.userbase import LoginSystem

from xquotient.mail import MailTransferAgent


def createDatabase(s):
    """
    Create an account in the given store and install a MailTransferAgent on
    both the given store and the substore for that account.
    """
    Scheduler(store=s).installOn(s)

    loginSystem = LoginSystem(store=s)
    loginSystem.installOn(s)

    mta = MailTransferAgent(store=s)
    mta.installOn(s)

    account = loginSystem.addAccount(u'testuser', u'localhost', None)
    subStore = account.avatars.open()
    SubScheduler(store=subStore).installOn(subStore)
    mda = MailTransferAgent(store=subStore)
    mda.installOn(subStore)


if __name__ == '__main__':
    saveStub(createDatabase, 7485)
from axiom.userbase import LoginMethod

from xquotient.compose import FromAddress


def createDatabase(s):
    LoginMethod(store=s,
                localpart=u'foo',
                domain=u'bar',
                verified=True,
                protocol=u'*',
                account=s,
                internal=False)

    FromAddress(store=s,
                address=u'foo@bar',
                smtpHost=u'bar',
                smtpPort=26,
                smtpUsername=u'foo',
                smtpPassword=u'secret')
    FromAddress(store=s,
                address=u'foo2@bar',
                smtpHost=u'bar',
                smtpPort=26,
                smtpUsername=u'foo2',
                smtpPassword=u'secret')


if __name__ == '__main__':
    saveStub(createDatabase, 9459)
from axiom.userbase import LoginMethod

from xquotient.compose import ComposePreferenceCollection, Composer

def createDatabase(s):
    """
    Install a Composer and ComposePreferenceCollection on the given store.
    """
    LoginMethod(store=s,
                localpart=u'foo',
                domain=u'bar',
                verified=True,
                protocol=u'*',
                account=s,
                internal=False)

    Composer(store=s).installOn(s)

    ComposePreferenceCollection(
        store=s,
        smarthostAddress=u'foo2@bar',
        smarthostUsername=u'foo2',
        smarthostPort=23,
        smarthostPassword=u'secret',
        preferredSmarthost=u'localhost').installOn(s)



if __name__ == '__main__':
    saveStub(createDatabase, 9097)
# -*- test-case-name: xmantissa.test.historic.test_pyLuceneIndexer4to5 -*-
# Copyright 2005 Divmod, Inc.  See LICENSE file for details

from axiom.test.historic.stubloader import saveStub

from xmantissa.test.historic.stub_pyLuceneIndexer3to4 import createDatabase as _createDatabase


def createDatabase(*a, **kw):
    return _createDatabase(*a, **kw)


if __name__ == "__main__":
    saveStub(createDatabase, 10568)
from axiom.test.historic.stubloader import saveStub

from xquotient.quotientapp import QuotientPreferenceCollection

def createDatabase(s):
    QuotientPreferenceCollection(store=s,
                                 preferredMimeType=u'image/png',
                                 preferredMessageDisplay=u'invisible',
                                 showRead=False,
                                 showMoreDetail=True)

if __name__ == '__main__':
    saveStub(createDatabase, 8528)
Beispiel #31
0
    messages[1].classifyClean()
    messages[1].deferFor(timedelta(days=10))
    messages[1].undefer()
    messages[1].archive()

    messages[2].classifyClean()
    messages[2].deferFor(timedelta(days=10))
    messages[2].markRead()

    # this one was sent (see above for entering the draft status)
    messages[3].startedSending()
    messages[3].sent()
    messages[3].finishedSending()

    # message 4 is a draft by default, we don't need to push it further through
    # the workflow.

    messages[5].classifyClean()
    messages[5].moveToTrash()

    messages[6].classifySpam()
    messages[6].moveToTrash()

    messages[7].classifySpam()
    messages[7].trainSpam()


if __name__ == '__main__':
    saveStub(createDatabase, 11812)
Beispiel #32
0
        'csA4Io17qmaJAORziqxHAkAb2zin9SzS58+X55pGVp8PwhGLmm9cGH/DtWVSIAl2\n'
        'q3pqCmcxnimc+IYJJlY6dkk7jtnIVTWz3B9XUOtKGEYF\n'
        '-----END RSA PRIVATE KEY-----\n')


def createDatabase(store):
    """
    Initialize the given Store for use as a Mantissa webserver.
    """
    Mantissa().installSite(store, u'')
    ws = store.findUnique(WebSite)
    ws.portNumber = 8088
    ws.securePortNumber = 6443
    ws.certificateFile = 'path/to/cert.pem'
    certPath = store.dbdir.child('path').child('to').child('cert.pem')
    certPath.parent().makedirs()
    fObj = certPath.open('w')
    fObj.write(cert)
    fObj.close()
    ws.httpLog = 'path/to/httpd.log'
    ws.hitCount = 123

    loginSystem = store.findUnique(LoginSystem)
    account = loginSystem.addAccount(u'testuser', u'localhost', None)
    subStore = account.avatars.open()
    WebSite(store=subStore, hitCount=321).installOn(subStore)


if __name__ == '__main__':
    saveStub(createDatabase, 7617)
"""

from axiom.test.historic.stubloader import saveStub
from axiom.dependency import installOn
from axiom.userbase import LoginSystem

from xmantissa.webapp import PrivateApplication

USERNAME = u"testuser"
DOMAIN = u"localhost"
PREFERRED_THEME = u"theme-preference"
HIT_COUNT = 8765
PRIVATE_KEY = 123456


def createDatabase(store):
    """
    Instantiate a L{PrivateApplication} in C{store} and install it.
    """
    loginSystem = LoginSystem(store=store)
    installOn(loginSystem, store)
    account = loginSystem.addAccount(USERNAME, DOMAIN, None)
    subStore = account.avatars.open()

    app = PrivateApplication(store=subStore, preferredTheme=PREFERRED_THEME, privateKey=PRIVATE_KEY)
    installOn(app, subStore)


if __name__ == "__main__":
    saveStub(createDatabase, 16534)
Beispiel #34
0
    "61S7WSv0G6pMqE9xw0llMBON7Pr24N/XzwJBALW+eFvrEgWDtQyi3FeEXkJFX+/5\n"
    "pnu86VMRiByeewREeLoc4ya7TbsOxtIgbXYa39fpmeIda0ajSc0J1UOv71kCQQCO\n"
    "q20vx8PrNc7WiTAY4HVUFcxEB5Ipb1X2qjqt+qkrBhsBpN/PZ0r89X2iw1RU1lwQ\n"
    "csA4Io17qmaJAORziqxHAkAb2zin9SzS58+X55pGVp8PwhGLmm9cGH/DtWVSIAl2\n"
    "q3pqCmcxnimc+IYJJlY6dkk7jtnIVTWz3B9XUOtKGEYF\n"
    "-----END RSA PRIVATE KEY-----\n"
)


def createDatabase(store):
    """
    Initialize the given Store for use as a Mantissa webserver.
    """
    Mantissa().installSite(store, u"")
    site = store.findUnique(WebSite)
    site.portNumber = 8088
    site.securePortNumber = 6443
    site.certificateFile = "server.pem"
    store.dbdir.child("server.pem").setContent(cert)
    site.httpLog = "path/to/httpd.log"
    site.hitCount = 123
    site.hostname = u"example.net"
    loginSystem = store.findUnique(LoginSystem)
    account = loginSystem.addAccount(u"testuser", u"localhost", None)
    subStore = account.avatars.open()
    installOn(WebSite(store=subStore, hitCount=321), subStore)


if __name__ == "__main__":
    saveStub(createDatabase, 11023)
# -*- test-case-name: xquotient.test.historic.test_inbox1to2 -*-
"""
Create a stub database for upgrade of L{xquotient.inbox.Inbox} from version 1
to version 2.
"""

from axiom.test.historic.stubloader import saveStub

from xquotient.exmess import Message
from xquotient.inbox import Inbox


def createDatabase(s):
    Inbox(store=s)
    Message(store=s, source=u'source one')
    Message(store=s, source=u'source one')
    Message(store=s, source=u'source two')


if __name__ == '__main__':
    saveStub(createDatabase, 7549)
"""
from axiom.test.historic.stubloader import saveStub
from axiom.userbase import LoginMethod

from xquotient.compose import FromAddress

def createDatabase(s):
    LoginMethod(store=s,
                localpart=u'foo',
                domain=u'bar',
                verified=True,
                protocol=u'*',
                account=s,
                internal=False)

    FromAddress(store=s,
                address=u'foo@bar',
                smtpHost=u'bar',
                smtpPort=26,
                smtpUsername=u'foo',
                smtpPassword=u'secret')
    FromAddress(store=s,
                address=u'foo2@bar',
                smtpHost=u'bar',
                smtpPort=26,
                smtpUsername=u'foo2',
                smtpPassword=u'secret')

if __name__ == '__main__':
    saveStub(createDatabase, 9459)
Beispiel #37
0
from axiom.test.historic.stubloader import saveStub
from xquotient.popout import POP3Listener
from axiom.userbase import LoginSystem


def createDatabase(s):
    LoginSystem(store=s).installOn(s)
    POP3Listener(store=s).installOn(s)


if __name__ == '__main__':
    saveStub(createDatabase, 10858)
Beispiel #38
0
    'IUzhVvBr/flWabpMJ9Vw3eLy695iFjgx+5W0nD+JK1ny8MiwCRsjoRTXldHhdaod\n'
    '8VbPz/QJAkEA6YmX6XksIb8JUYFtPk0WodQmz51qzo0jol3COL/rXuPVkTcesyTM\n'
    '61S7WSv0G6pMqE9xw0llMBON7Pr24N/XzwJBALW+eFvrEgWDtQyi3FeEXkJFX+/5\n'
    'pnu86VMRiByeewREeLoc4ya7TbsOxtIgbXYa39fpmeIda0ajSc0J1UOv71kCQQCO\n'
    'q20vx8PrNc7WiTAY4HVUFcxEB5Ipb1X2qjqt+qkrBhsBpN/PZ0r89X2iw1RU1lwQ\n'
    'csA4Io17qmaJAORziqxHAkAb2zin9SzS58+X55pGVp8PwhGLmm9cGH/DtWVSIAl2\n'
    'q3pqCmcxnimc+IYJJlY6dkk7jtnIVTWz3B9XUOtKGEYF\n'
    '-----END RSA PRIVATE KEY-----\n')

def createDatabase(store):
    """
    Initialize the given Store for use as a Mantissa webserver.
    """
    Mantissa().installSite(store, u'')
    site = store.findUnique(WebSite)
    site.portNumber = 8088
    site.securePortNumber = 6443
    site.certificateFile = 'server.pem'
    store.dbdir.child('server.pem').setContent(cert)
    site.httpLog = 'path/to/httpd.log'
    site.hitCount = 123
    site.hostname = u'example.net'
    loginSystem = store.findUnique(LoginSystem)
    account = loginSystem.addAccount(u'testuser', u'localhost', None)
    subStore = account.avatars.open()
    installOn(WebSite(store=subStore, hitCount=321), subStore)


if __name__ == '__main__':
    saveStub(createDatabase, 11023)
Beispiel #39
0
# -*- test-case-name: xquotient.test.historic.test_inbox1to2 -*-

"""
Create a stub database for upgrade of L{xquotient.inbox.Inbox} from version 1
to version 2.
"""

from axiom.test.historic.stubloader import saveStub

from xquotient.exmess import Message
from xquotient.inbox import Inbox

def createDatabase(s):
    Inbox(store=s)
    Message(store=s, source=u'source one')
    Message(store=s, source=u'source one')
    Message(store=s, source=u'source two')

if __name__ == '__main__':
    saveStub(createDatabase, 7549)
Beispiel #40
0
# -*- test-case-name: axiom.test.historic.test_manhole1to2 -*-
# Copyright 2008 Divmod, Inc.  See LICENSE for details.

from axiom.dependency import installOn
from axiom.batch import BatchManholePowerup
from axiom.test.historic.stubloader import saveStub


def createDatabase(store):
    installOn(BatchManholePowerup(store=store), store)


if __name__ == '__main__':
    saveStub(createDatabase, 16829)
Beispiel #41
0
"""
Generate a stub for the tests for the upgrade from schema version 2 to 3 of the
Person item.
"""

from epsilon.extime import Time

from axiom.test.historic.stubloader import saveStub

from xmantissa.people import Organizer, Person

NAME = u"Test User"
CREATED = Time.fromPOSIXTimestamp(1234567890)


def createDatabase(store):
    """
    Make a L{Person} in the given store.
    """
    organizer = Organizer(store=store)
    person = Person(store=store, organizer=organizer, name=NAME)
    person.created = CREATED


if __name__ == "__main__":
    saveStub(createDatabase, 13344)
Beispiel #42
0
# improbably port numbers and hope they aren't bound.  If they are, the test
# will fail.  Hooray! -exarkun
TCP_PORT = 29415
SSL_PORT = 19224


def createDatabase(siteStore):
    """
    Populate the given Store with a TCPPort and SSLPort.
    """
    factory = WebSite(store=siteStore)
    installOn(factory, siteStore)
    installOn(TCPPort(store=siteStore, portNumber=TCP_PORT, factory=factory),
              siteStore)
    certificatePath = siteStore.newFilePath('certificate')

    key = KeyPair.generate()
    cert = key.selfSignedCert(1)
    certificatePath.setContent(
        cert.dump(FILETYPE_PEM) + key.dump(FILETYPE_PEM))

    installOn(
        SSLPort(store=siteStore,
                portNumber=SSL_PORT,
                certificatePath=certificatePath,
                factory=factory), siteStore)


if __name__ == '__main__':
    saveStub(createDatabase, 12731)
Beispiel #43
0
from axiom.test.historic.stubloader import saveStub
from axiom.userbase import LoginMethod

from xquotient.compose import ComposePreferenceCollection, Composer


def createDatabase(s):
    """
    Install a Composer and ComposePreferenceCollection on the given store.
    """
    LoginMethod(store=s,
                localpart=u'foo',
                domain=u'bar',
                verified=True,
                protocol=u'*',
                account=s,
                internal=False)

    Composer(store=s).installOn(s)

    ComposePreferenceCollection(store=s,
                                smarthostAddress=u'foo2@bar',
                                smarthostUsername=u'foo2',
                                smarthostPort=23,
                                smarthostPassword=u'secret',
                                preferredSmarthost=u'localhost').installOn(s)


if __name__ == '__main__':
    saveStub(createDatabase, 9097)
Beispiel #44
0
    messages[1].classifyClean()
    messages[1].deferFor(timedelta(days=10))
    messages[1].undefer()
    messages[1].archive()

    messages[2].classifyClean()
    messages[2].deferFor(timedelta(days=10))
    messages[2].markRead()

    # this one was sent (see above for entering the draft status)
    messages[3].startedSending()
    messages[3].sent()
    messages[3].finishedSending()

    # message 4 is a draft by default, we don't need to push it further through
    # the workflow.

    messages[5].classifyClean()
    messages[5].moveToTrash()

    messages[6].classifySpam()
    messages[6].moveToTrash()

    messages[7].classifySpam()
    messages[7].trainSpam()


if __name__ == '__main__':
    saveStub(createDatabase, 11812)
Beispiel #45
0
# test-case-name: axiom.test.historic.test_scheduler1to2

"""
Database creator for the test for the upgrade of Scheduler from version 1 to
version 2.
"""

from axiom.test.historic.stubloader import saveStub

from axiom.scheduler import Scheduler
from axiom.dependency import installOn


def createDatabase(store):
    installOn(Scheduler(store=store), store)


if __name__ == '__main__':
    saveStub(createDatabase, 17606)
from axiom.test.historic.stubloader import saveStub
from xmantissa.webadmin import AdminStatsApplication


def createDatabase(s):
    AdminStatsApplication(store=s)


if __name__ == '__main__':
    saveStub(createDatabase, 11254)
from axiom.test.historic.stubloader import saveStub

from xmantissa.signup import FreeTicketSignup

def createDatabase(s):
    FreeTicketSignup(store=s,
                     prefixURL=u'/a/b',
                     booth=s,
                     benefactor=s,
                     emailTemplate=u'TEMPLATE!')

if __name__ == '__main__':
    saveStub(createDatabase, 5809)
Beispiel #48
0
# -*- test-case-name: axiom.test.historic.test_catalog1to2 -*-


from axiom.item import Item
from axiom.attributes import text
from axiom.tags import Catalog
from axiom.test.historic.stubloader import saveStub

class Dummy(Item):
    attribute = text(doc="dummy attribute")



def createDatabase(s):
    """
    Populate the given Store with a Catalog and some Tags.
    """
    c = Catalog(store=s)
    c.tag(c, "internal")
    c.tag(s, "internal")
    i = Dummy(store=s)
    c.tag(i, "external")
    c.tag(i, "green")



if __name__ == '__main__':
    saveStub(createDatabase, 6917)
# -*- test-case-name: axiom.test.historic.test_parentHook3to4 -*-
"""
Generate a test stub for upgrading L{_SubSchedulerParentHook} from version 3 to
4, which removes the C{scheduler} attribute.
"""

from axiom.test.historic.stubloader import saveStub

from axiom.dependency import installOn
from axiom.scheduler import Scheduler, _SubSchedulerParentHook
from axiom.substore import SubStore


def createDatabase(store):
    scheduler = Scheduler(store=store)
    installOn(scheduler, store)
    installOn(
        _SubSchedulerParentHook(store=store,
                                loginAccount=SubStore(store=store)), store)


if __name__ == '__main__':
    saveStub(createDatabase, 17606)
from xmantissa import prefs

def createDatabase(s):
    prefs.DefaultPreferenceCollection(store=s)

from axiom.test.historic.stubloader import saveStub

if __name__ == '__main__':
    saveStub(createDatabase)
from axiom.test.historic.stubloader import saveStub
from axiom.userbase import LoginMethod
from xquotient.spam import SpambayesFilter


def createDatabase(s):
    SpambayesFilter(store=s)


if __name__ == '__main__':
    saveStub(createDatabase, 10876)
Beispiel #52
0
from axiom.test.historic.stubloader import saveStub
from xmantissa.people import AddPerson

def createDatabase(s):
    AddPerson(store=s)

if __name__ == '__main__':
    saveStub(createDatabase, 10664)
Beispiel #53
0
# -*- test-case-name: axiom.test.historic.test_textlist -*-


from axiom.item import Item
from axiom.attributes import textlist
from axiom.test.historic.stubloader import saveStub

class Dummy(Item):
    typeName = 'axiom_textlist_dummy'
    schemaVersion = 1

    attribute = textlist(doc="a textlist")



def createDatabase(s):
    """
    Populate the given Store with some Dummy items.
    """
    Dummy(store=s, attribute=[u'foo', u'bar'])



if __name__ == '__main__':
    saveStub(createDatabase, 11858)
Beispiel #54
0
from axiom.dependency import installOn
from axiom.userbase import LoginSystem

from xmantissa.webapp import PrivateApplication

USERNAME = u'testuser'
DOMAIN = u'localhost'
PREFERRED_THEME = u'theme-preference'
HIT_COUNT = 8765
PRIVATE_KEY = 123456


def createDatabase(store):
    """
    Instantiate a L{PrivateApplication} in C{store} and install it.
    """
    loginSystem = LoginSystem(store=store)
    installOn(loginSystem, store)
    account = loginSystem.addAccount(USERNAME, DOMAIN, None)
    subStore = account.avatars.open()

    app = PrivateApplication(
        store=subStore,
        preferredTheme=PREFERRED_THEME,
        privateKey=PRIVATE_KEY)
    installOn(app, subStore)


if __name__ == '__main__':
    saveStub(createDatabase, 16534)
"""
Create stub database for upgrade of L{xquotient.compose.Composer} from version 4
to version 5.
"""


from axiom.test.historic.stubloader import saveStub
from axiom.dependency import installOn
from axiom.userbase import LoginMethod

from xquotient.compose import Composer


def createDatabase(s):
    """
    Install a Composer on the given store.
    """
    LoginMethod(store=s,
                localpart=u'foo',
                domain=u'bar',
                verified=True,
                protocol=u'*',
                account=s,
                internal=False)
    installOn(Composer(store=s), s)


if __name__ == '__main__':
    saveStub(createDatabase, 10991)
# -*- test-case-name xquotient.test.test_historic.test_needsDelivery1to2 -*-

"""
Create stub database for upgrade of L{xquotient.compose._NeedsDelivery} from
version 1 to version 2.
"""

from axiom.test.historic.stubloader import saveStub

from xquotient.compose import _NeedsDelivery, Composer

def createDatabase(s):
    """
    Install a _NeedsDelivery and Composer on the given store.
    """
    _NeedsDelivery(store=s,
                   composer=Composer(store=s),
                   message=s,
                   toAddress=u'to@host',
                   tries=21)



if __name__ == '__main__':
    saveStub(createDatabase, 9283)
    running = property(lambda : False)

    def setName(self, name):
        pass
    def setServiceParent(self, parent):
        pass
    def disownServiceParent(self):
        pass
    def startService(self):
        self.everStarted = True
    def stopService(self):
        pass
    def privilegedStartService(self):
        pass


def createDatabase(s):
    """
    Create a store which contains a substore-service-starter item powered up
    for IService, and a substore, which contains a service that should not be
    started after the upgrader runs.
    """
    ssi = SubStore.createNew(s, ["sub", "test"])
    ss = ssi.open()
    ds = DummyService(store=ss)
    ss.powerUp(ds, IService)
    ssss = SubStoreStartupService(store=s).installOn(s)

if __name__ == '__main__':
    saveStub(createDatabase, 7615)