In TG2, would you call the following a unit test, or a functional
test?

class TestIndex(TestController):
    def test_index(self):
        """index controller has expected template and namespace.
        """
        response = self.app.get('/')
        # Confirm template name
        assert_equal(response.template_name,
'helloworld.templates.index')
        # Confirm namespace contents
        assert_true('page' in response.namespace,
response.namespace.keys())
        assert_equal(response.namespace['page'], 'index')

It's the closest thing I can come up with to TG1's

class TestIndex(testutil.DBTest):
    def test_index_page_data(self):
        page_data = testutil.call(cherrypy.root.index)
        assert_true('page' in page_data, page_data.keys())
        assert_equal(page_data['page'], 'index')

and I certainly think that's a unit test because it's examining the
dictionary returned by the index method.

OTOH, these tests are kind of functional because we have to go through
the server to get the result we're examining.  But it's not the end
result (rendered HTML).

The reason I am asking is that I'm trying to decide how to describe
tests like the 1st fragment on the 
http://docs.turbogears.org/2.0/RoughDocs/AppTesting
page I'm working on.  Also, I need to know whether to put sample test
code like this into +package+/tests/ or +package+/tests/functional/ in
the templates.

Opinions welcome...

Doug
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to