Esempio n. 1
0
 def test_addresses(self):
     p = Contacts([
         Contact('Bill', ['*****@*****.**', '*****@*****.**'], 30),
         Contact('Joe', ['*****@*****.**'], 30)
     ])
     assert p.addresses() == ['*****@*****.**', '*****@*****.**',
                              '*****@*****.**']
Esempio n. 2
0
    def test_parse(self):
        contacts = Contacts()
        contacts.parse('tests/data/blanco.conf', 'frequency')

        assert repr(contacts) == \
            ('Contacts(['
             "Contact('Bill', ['*****@*****.**'], 30), "
             "Contact('Joe', ['*****@*****.**'], 30), "
             "Contact('Steven', ['*****@*****.**'], 365)"
             '])')
Esempio n. 3
0
    def test_parse(self):
        contacts = Contacts()
        contacts.parse('tests/data/blanco.conf', 'frequency')

        # Dirty, dirty, way to handle Unicode type repr differences... sorry
        expect(repr(contacts)) == \
            ('Contacts(['
             "Contact(u'Bill', [u'*****@*****.**'], 30), "
             "Contact(u'Joe', [u'*****@*****.**'], 30), "
             "Contact(u'Steven', [u'*****@*****.**'], 365)"
             '])'.replace("u'", "u'" if PY2 else "'"))
Esempio n. 4
0
 def test_parse_missing_file(self, tmpdir):
     contacts = Contacts()
     with raises(IOError) as err:
         contacts.parse(str(tmpdir.join('no_such_file')), 'frequency')
     assert 'Addressbook file not found' in str(err.value)