~ubuntu-branches/ubuntu/precise/desktopcouch/precise

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Chad MILLER
  • Date: 2010-06-22 16:21:19 UTC
  • Revision ID: james.westby@ubuntu.com-20100622162119-3ebuc61x323kahha
Tags: 0.6.6-0ubuntu1
* New upstream release, 0.6.6. (There is no 0.6.5, except in the wild.)
* Resolve circular dependencies.  Group together dependent code in 
  'desktopcouch' package, and make transition packages of subpackages.
  Upstream will try decoupling properly in future.  (Debian: #571929)
* debian/patches/lp_522538.patch
  - No longer needed.  Removed.
* debian/patches/replication-exclusion.patch
  - No longer needed.  Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import testtools
22
22
 
23
 
from desktopcouch.contacts.record import Contact, CONTACT_RECORD_TYPE
 
23
from desktopcouch.contacts import record as contact_mod
 
24
 
24
25
 
25
26
class TestContactRecord(testtools.TestCase):
26
27
    """Test the Contact Record object."""
27
28
 
28
29
    def test_contact_record(self):
29
30
        """Test that we get the correct record type."""
30
 
        contact = Contact()
31
 
        self.assertEqual(CONTACT_RECORD_TYPE, contact.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)