~ubuntu-branches/ubuntu/trusty/desktopcouch/trusty

« back to all changes in this revision

Viewing changes to desktopcouch/contacts/tests/test_record.py

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2010-04-19 12:52:22 UTC
  • mfrom: (12.1.9 lucid)
  • Revision ID: james.westby@ubuntu.com-20100419125222-zsh9lrm15h84951j
* debian/patches/lp_522538.patch
  - Handle reconnects if the server isn't running (LP: #522538)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import testtools
22
22
 
23
 
from desktopcouch.contacts import record as contact_mod
24
 
 
 
23
from desktopcouch.contacts.record import Contact, CONTACT_RECORD_TYPE
25
24
 
26
25
class TestContactRecord(testtools.TestCase):
27
26
    """Test the Contact Record object."""
28
27
 
29
28
    def test_contact_record(self):
30
29
        """Test that we get the correct record type."""
31
 
        contact = contact_mod.Contact()
32
 
        self.assertEqual(contact.record_type, contact_mod.CONTACT_RECORD_TYPE)
33
 
        for field_name in contact_mod.SINGLE_FIELDS:
34
 
            setattr(contact, field_name, field_name)
35
 
            self.assertEqual(getattr(contact, field_name), field_name)
36
 
            # direct access to internal representation
37
 
            self.assertEqual(contact._data[field_name], field_name)
38
 
        for field_name in contact_mod.LIST_FIELDS:
39
 
            setattr(contact, field_name, [field_name])
40
 
            self.assertEqual(getattr(contact, field_name), [field_name])
41
 
            # direct access to internal representation
42
 
            self.assert_(field_name in contact._data[field_name].values())
43
 
        # transversal check
44
 
        all_keys = set(contact_mod.ALL_FIELDS)
45
 
        all_keys.add('record_type')
46
 
        self.assertEqual(set(contact.keys()), all_keys)
 
30
        contact = Contact()
 
31
        self.assertEqual(CONTACT_RECORD_TYPE, contact.record_type)