I am trying to figure out this test. I am not able to understand this one.

Please explain the following..

   1. What are the parameters "addr-1.ord", and so on.
   2. I checked that td is a decorator import. But not able to figure out
   the use of the line

           with td.audits('Email address deleted: [email protected]',
   user=True):

   3. In the decorator, have the messages been stored in database
   beforehand to match the test outputs? on which assertions are added?
   4. If a primary email is deleted, and uer now has 2 emails both of them
   confirmed, which one is made primary?

Allura/allura/tests/functional/test_site_admin.py

        # remove [email protected]
        with td.audits('Email address deleted: [email protected]',
user=True):
            r = self.app.post('/nf/admin/user/update_emails', params={
                'username': 'test-user',
                'addr-1.ord': '1',
                'addr-2.ord': '2',
                'addr-2.delete': 'on',
                'new_addr.addr': '',
                'primary_addr': '[email protected]'},
                extra_environ=dict(username='test-admin'))
        r = self.app.get('/nf/admin/user/test-user')
        user = M.User.query.get(username='test-user')
        # [email protected] set as primary since [email protected] is deleted
        assert_equal(user.get_pref('email_address'), '[email protected]')

This test's failing log -

FAIL: allura.tests.functional.test_site_admin:TestUserDetails.test_emails
  vi +683 allura/tests/functional/test_site_admin.py  # test_emails
    extra_environ=dict(username='test-admin'))
  vi +24  /usr/lib/python2.7/contextlib.py  # __exit__
    self.gen.next()
  vi +175 allura/tests/decorators.py  # audits
    message=re.compile(preamble + message))).count(), 'Could not find "%s"'
% message
AssertionError: Could not find "Email address deleted: [email protected]"
-------------------- >> begin captured stdout << ---------------------
Running setup_app() from allura.websetup

--------------------- >> end captured stdout << ----------------------
-------------------- >> begin captured logging << --------------------
pylons.configuration: DEBUG: Initializing configuration, package: 'allura'
allura.lib.app_globals: WARNING: Solr config not set; using in-memory
MockSOLR
routes.middleware: DEBUG: Initialized with method overriding = True, and
path info altering = True
ew.resource: INFO: Loading ep ew_resources =
allura.config.resources:register_ew_resources
ew.resource: INFO: Loading ep ew_resources =
forgeactivity.config.resources:register_ew_resources
ew.resource: INFO: Loading ep ew_resources =
forgetracker.config.resources:register_ew_resources
ew.render: DEBUG: Loading template engine jinja
ew.render: DEBUG: Loading template engine kajiki-text
ew.render: DEBUG: Error loading engine kajiki-text
ew.render: DEBUG: Loading template engine kajiki
ew.render: DEBUG: Error loading engine kajiki
ew.render: DEBUG: Loading template engine kajiki-html5
ew.render: DEBUG: Error loading engine kajiki-html5
ew.render: DEBUG: Loading template engine kajiki-html4
ew.render: DEBUG: Error loading engine kajiki-html4
ew.render: DEBUG: Loading template engine json
ew.render: DEBUG: Loading template engine jinja2
ew.render: DEBUG: Loading template engine kajiki-xml
ew.render: DEBUG: Error loading engine kajiki-xml
ew.render: DEBUG: Loading template engine genshi
ew.render: DEBUG: Loading template engine core-ew
--------------------- >> end captured logging << ---------------------

Reply via email to