I guess I missed a lot, I have to do the tutorial again and get back. quick tutorial is not that quick at all ;)
Thanks a lot. On Wednesday, January 25, 2017 at 1:50:55 AM UTC+4, Steve Piercy wrote: > > Take a look at this step in the SQLAlchemy + URL Dispatch wiki tutorial. > > http://docs.pylonsproject.org/projects/pyramid/en/latest/tutorials/wiki2/tests.html > > > --steve > > > On 1/24/17 at 11:52 AM, [email protected] <javascript:> (Jaime Sangcap) > pronounced: > > > Hi everyone! Im trying to learn python and getting my hands dirty with > > pyramid. > > > > I would really appreciate it if there is anyone willing to give me a > > kickstart on how to do functional test? > > Lets say I posted a data to a url and I want to test that the data has > been > > saved to the persistent store or fake store. > > How should I do it? > > > > I have this test class: > > > > class TestCatalogView: > > def test_it_loads_catalog_add_page(self, testapp): > > testapp.get('/catalog/add', status=200) > > > > def test_it_adds_the_course_on_the_catalog(self, testapp): > > response = testapp.post('/catalog/add', status='30*') > > assert 'Course has been added' in response.body > > > > # here I want to assert that the data has been persisted > > > > > > the testapp is a fixture with the following details: > > > > @fixture(scope='session') > > def pyramid_test_setup(): > > yield testing.setUp() > > testing.tearDown() > > > > > > @fixture(scope='session') > > def testapp(pyramid_test_setup): > > from tgpweb import main > > from pyramid.paster import get_appsettings > > settings = get_appsettings('testing.ini', 'main') > > app = main(global_config=None, **settings) > > return webtest.TestApp(app) > > > > > > > > What are the things needed to test this? Im thinking of making a > Repository > > Class which uses SqlAlchemy, and another one as Fake repository so that > in > > case I dont want to hit a real database I can swap the implementation > > > > > > If Im doing it wrong please guide me on how to make it right. maybe I > have > > the wrong mindset in testing. > > > > > > Thank you in advance! > > > > ------------------------ > Steve Piercy, Soquel, CA > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/a6af3a81-0e28-4718-8ac3-1bae60a90cd3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
