def test_appStoreLinkTo(self): """ When L{websharing.linkTo} is called on a shared item in an app store, it returns an URL with a single path segment consisting of the app's name. """ s = Store(dbdir=self.mktemp()) Mantissa().installSite(s, u"localhost", u"", False) Mantissa().installAdmin(s, u'admin', u'localhost', u'asdf') off = offering.Offering( name=u'test_offering', description=u'Offering for creating a sample app store', siteRequirements=[], appPowerups=[TestAppPowerup], installablePowerups=[], loginInterfaces=[], themes=[], ) userbase = s.findUnique(LoginSystem) adminAccount = userbase.accountByAddress(u'admin', u'localhost') conf = adminAccount.avatars.open().findUnique( offering.OfferingConfiguration) conf.installOffering(off, None) ss = userbase.accountByAddress(off.name, None).avatars.open() sharedItem = sharing.getEveryoneRole(ss).getShare( websharing.getDefaultShareID(ss)) linkURL = websharing.linkTo(sharedItem) self.failUnless( isinstance(linkURL, url.URL), "linkTo should return a nevow.url.URL, not %r" % (type(linkURL))) self.assertEquals(str(linkURL), '/test_offering/')
def setUp(self): self.store = Store(filesdir=self.mktemp()) Mantissa().installSite(self.store, u"localhost", u"", False) Mantissa().installAdmin(self.store, u'admin', u'localhost', u'asdf') self.userbase = self.store.findUnique(userbase.LoginSystem) self.adminAccount = self.userbase.accountByAddress( u'admin', u'localhost') off = offering.Offering( name=u'test_offering', description=u'This is an offering which tests the offering ' 'installation mechanism', siteRequirements=[(ITestInterface, TestSiteRequirement)], appPowerups=[TestAppPowerup], installablePowerups=[], loginInterfaces=[], themes=[], ) self.offering = off # Add this somewhere that the plugin system is going to see it. self._originalGetOfferings = offering.getOfferings offering.getOfferings = self.fakeGetOfferings
from xmantissa import offering from xmantissa.web import SiteConfiguration from xmantissa.webtheme import MantissaTheme from xmantissa.publicweb import AnonymousSite from xmantissa.ampserver import AMPConfiguration, AMPAvatar, EchoFactory from xmantissa.terminal import SecureShellConfiguration import xmantissa baseOffering = offering.Offering( name=u'mantissa-base', description=u'Basic Mantissa functionality', siteRequirements=[(ISiteURLGenerator, SiteConfiguration), (IResource, AnonymousSite), (None, SecureShellConfiguration)], appPowerups=(), installablePowerups=(), loginInterfaces=[(IResource, "HTTP logins"), (IConchUser, "SSH logins")], # priority should be 0 for pretty much any other theme. 'base' is the theme # that all other themes should use as a reference for what elements are # required. themes=(MantissaTheme('base', 1), ), staticContentPath=FilePath(xmantissa.__file__).sibling('static'), version=xmantissa.version) # XXX This should be part of baseOffering, but because there is no # functionality for upgrading installed offering state, doing so would create a # class of databases which thought they had amp installed but didn't really. # See #2723. ampOffering = offering.Offering( name=u'mantissa-amp', description=u'Extra AMP-related Mantissa functionality',
# -*- test-case-name: imaginary.test -*- """ Mantissa Offering Plugin for Imaginary """ from xmantissa import offering from imaginary.world import ImaginaryWorld from imaginary.wiring.textserver import ImaginaryApp imaginaryOffering = offering.Offering( name=u"imaginary", description=u""" A simulation framework for text adventures. """, siteRequirements=[], appPowerups=[ImaginaryWorld], installablePowerups=[(u"Imaginary Game", u"A text adventure of some variety.", ImaginaryApp)], loginInterfaces=[], themes=[])
from xmantissa import offering, stats from xmantissa.webadmin import (TracebackViewer, LocalUserBrowser, DeveloperApplication, PortConfiguration) from xmantissa.signup import SignupConfiguration adminOffering = offering.Offering( name = u'mantissa', description = u'Powerups for administrative control of a Mantissa server.', siteRequirements = [], appPowerups = [stats.StatsService], installablePowerups = [("Signup Configuration", "Allows configuration of signup mechanisms", SignupConfiguration), ("Traceback Viewer", "Allows viewing unhandled exceptions which occur on the server", TracebackViewer), ("Port Configuration", "Allows manipulation of network service configuration.", PortConfiguration), ("Local User Browser", "A page listing all users existing in this site's store.", LocalUserBrowser), ("Admin REPL", "An interactive python prompt.", DeveloperApplication), ("Offering Configuration", "Allows installation of Offerings on this site", offering.OfferingConfiguration), ("Stats Observation", "Allows remote observation via AMP of gathered performance-related stats", stats.RemoteStatsCollectorFactory), ], loginInterfaces=(), themes = ())
from twisted.python.filepath import FilePath from axiom import userbase from xmantissa import website, offering import sine from sine import sipserver, sinetheme from sine.voicemail import VoicemailDispatcher plugin = offering.Offering( name=u"Sine", description=u""" The Sine SIP proxy and registrar. """, siteRequirements=((userbase.IRealm, userbase.LoginSystem), (None, website.WebSite), (None, sipserver.SIPServer)), appPowerups=(), installablePowerups= [("SIP", "Gives user a SIP URL and the ability to send and receive calls through a SIP proxy", sipserver.TrivialContact), ("Voicemail", "Records voicemail for calls to user's SIP URL when no user agent is registered.", VoicemailDispatcher)], loginInterfaces=(), themes=(sinetheme.SineTheme('base'), ), staticContentPath=FilePath(sine.__file__).sibling('static'))
class OfferingTechnicianTestMixin: """ L{unittest.TestCase} mixin which defines unit tests for classes which implement L{IOfferingTechnician}. @ivar offerings: A C{list} of L{Offering} instances which will be installed by the tests this mixin defines. """ offerings = [ offering.Offering(u'an offering', None, [], [], [], [], []), offering.Offering(u'another offering', None, [], [], [], [], []) ] def createTechnician(self): """ @return: An L{IOfferingTechnician} provider which will be tested. """ raise NotImplementedError("%r did not implement createTechnician" % (self.__class__, )) def test_interface(self): """ L{createTechnician} returns an instance of a type which declares that it implements L{IOfferingTechnician} and has all of the methods and attributes defined by the interface. """ technician = self.createTechnician() technicianType = type(technician) self.assertTrue( ixmantissa.IOfferingTechnician.implementedBy(technicianType)) self.assertTrue( verifyClass(ixmantissa.IOfferingTechnician, technicianType)) self.assertTrue( verifyObject(ixmantissa.IOfferingTechnician, technician)) def test_getInstalledOfferingNames(self): """ The L{ixmantissa.IOfferingTechnician.getInstalledOfferingNames} implementation returns a C{list} of C{unicode} strings, each element giving the name of an offering which has been installed. """ offer = self.createTechnician() self.assertEqual(offer.getInstalledOfferingNames(), []) expected = [] for dummyOffering in self.offerings: offer.installOffering(dummyOffering) expected.append(dummyOffering.name) expected.sort() installed = offer.getInstalledOfferingNames() installed.sort() self.assertEqual(installed, expected) def test_getInstalledOfferings(self): """ The L{ixmantissa.IOfferingTechnician.getInstalledOfferings} implementation returns a C{dict} mapping C{unicode} offering names to the corresponding L{IOffering} providers. """ offer = self.createTechnician() self.assertEqual(offer.getInstalledOfferings(), {}) expected = {} for dummyOffering in self.offerings: offer.installOffering(dummyOffering) expected[dummyOffering.name] = dummyOffering self.assertEqual(offer.getInstalledOfferings(), expected)
from axiom import userbase from xmantissa import website, offering from eridanus import theme plugin = offering.Offering(name=u'Eridanus', description=u'URL tracking IRC bot', siteRequirements=[ (userbase.IRealm, userbase.LoginSystem), (None, website.WebSite), ], appPowerups=[], installablePowerups=[], loginInterfaces=[], themes=[ theme.Theme('eridanus-base', 0), ])
This module is a plugin for Mantissa which provides a Hyperbola offering. """ from twisted.python.filepath import FilePath from axiom import userbase from xmantissa import website, offering from hyperbola import hyperbola_model from hyperbola.hyperbola_theme import HyperbolaTheme from hyperbola.publicpage import HyperbolaPublicPage import hyperbola plugin = offering.Offering( name=u"Hyperbola", description=u""" A basic weblog system. """, siteRequirements=[(userbase.IRealm, userbase.LoginSystem), (None, website.WebSite)], appPowerups=(), installablePowerups=[ (u'Publisher', u'Allows publishing of posts in a weblog format.', hyperbola_model.HyperbolaPublicPresence) ], loginInterfaces=(), themes=[HyperbolaTheme('base', 0)], version=hyperbola.version, staticContentPath=FilePath(hyperbola.__file__).sibling('static'))
plugin = offering.Offering( name=u'Quotient', description=u''' A mail system with a web UI, supporting SMTP and POP3. ''', siteRequirements=((userbase.IRealm, userbase.LoginSystem), (None, website.WebSite), (None, popout.POP3Listener), (None, mail.MailTransferAgent)), appPowerups=(), installablePowerups= ((u'quotient', u'Incoming SMTP, Address Book', Inbox), (u'Extracts', u'Data-driven feature discovery, extraction, and presentation', ExtractPowerup), (u'Indexing', u'Full-text email (and other stuff) indexing', MessageSearchProvider), (u'Grabbers', u'Remote message retrieval', GrabberConfiguration), (u'Sending Mail', u'Allows message transmission', Composer), (u'POP Server', u'Access to mail via POP3', POP3Up ), (u'Rule Filtering', u'User-customizable filtering of messages based on headers and such.', RuleFilteringPowerup), (u'Mailing List Filtering', u'Automatic filtering of messages sent by various mailing list managers.', MailingListFilteringPowerup), (u'Focus', u'Highly filtered message view.', Focus), (u'Quotient People Plugins', u'Per-person Image/Extract/Picture lists', MessageLister), (u'Spambayes-based trainable Ham/Spam Filtering', u'Filtering of messages based on a bayesian classification with per-user training information.', SpambayesFilter)), loginInterfaces=[(IMessageDelivery, "SMTP logins"), (IMailbox, "POP3 logins")], themes=[QuotientTheme('base', 0)], version=xquotient.version, staticContentPath=FilePath(xquotient.__file__).sibling('static'))
from xmantissa import people, offering, website peopleOffering = offering.Offering( name=u'People', description=u'Basic organizer and addressbook support.', siteRequirements=((None, website.WebSite), ), appPowerups=(), installablePowerups=[("People", "Organizer and Address Book", people.AddPerson)], loginInterfaces=(), themes=())