Exemple #1
0
   
from lino.misc.tsttools import TestCase, main
from lino.apps.pizzeria import services
from lino.apps.pizzeria.pizzeria import Customer


class Case(TestCase):
    """
    (this failed on 20040322)
    """

    def setUp(self):
        TestCase.setUp(self)
        app=services.MyPizzeria()
        self.sess=app.createContext()
        services.populate(self.sess)

    def tearDown(self):
        self.sess.shutdown()

    def test01(self):
        CUST = self.sess.query(Customer)
        c = CUST.appendRow(name="Mark")
        newID = c.id
        c = CUST.peek(newID)
        self.assertEqual(c.id,newID) # failed
        
if __name__ == '__main__':
    main()

Exemple #2
0
## Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

import os
from lino.misc import tsttools
from lino.oogen import TextDocument, elements

class Case(tsttools.TestCase):
    
    def test01(self):
        "First styles"
        fn = self.addTempFile("2.sxw", showOutput=True)
        doc = TextDocument(fn)
        
        s = doc.addStyle(name="Rechts",
                         family="paragraph",
                         parentStyleName="Standard",
                         className="text")
        s.addProperties(textAlign="end",
                        justifySingleWord=False)
        
        
        doc.body.heading(1,"Defining custom styles")
        doc.body.par("This is a right-aligned paragraph.",
                     styleName="Rechts")
        doc.body.par("Here is a standard paragraph.")
    
        doc.save()
        
if __name__ == "__main__":
    tsttools.main()
Exemple #3
0

class Introduction(TestCase):
    def setUp(self):
        TestCase.setUp(self)
        self.db = startup()

    def tearDown(self):
        self.db.shutdown()

    def test01(self):
        PAGES = self.db.query(Node)
        #print [a.name for a in PAGES._table.peekQuery._atoms]
        PAGES.appendRow(match="index",
                        title="Main page",
                        abstract="Welcome",
                        body="bla bla" * 50)
        PAGES.appendRow(match="copyright",
                        title="Copyright",
                        abstract="Legal notes for this site.",
                        body="BLA BLA" * 50)
        # PAGES.commit()
        # PAGES.query("id match title",match="index").report()
        row = PAGES.findone(match="index")

        self.assertEqual(row.title, 'Main page')


if __name__ == '__main__':
    main()
Exemple #4
0
## You should have received a copy of the GNU General Public License
## along with Lino; if not, write to the Free Software Foundation,
## Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

import os
from lino.misc import tsttools
from lino.oogen import TextDocument, elements


class Case(tsttools.TestCase):
    def test01(self):
        "First styles"
        fn = self.addTempFile("2.sxw", showOutput=True)
        doc = TextDocument(fn)

        s = doc.addStyle(name="Rechts",
                         family="paragraph",
                         parentStyleName="Standard",
                         className="text")
        s.addProperties(textAlign="end", justifySingleWord=False)

        doc.body.heading(1, "Defining custom styles")
        doc.body.par("This is a right-aligned paragraph.", styleName="Rechts")
        doc.body.par("Here is a standard paragraph.")

        doc.save()


if __name__ == "__main__":
    tsttools.main()