Esempio n. 1
0
    def test_use(self):
        """Contact with use statement"""
        okconfig.addcontact('testcontact', use="okc-contact")

        contacts = Model.Contact.objects.filter(contact_name='testcontact')

        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('okc-contact', contacts[0].use)
Esempio n. 2
0
    def test_withgroup(self):
        """Make a contact within a group"""
        okconfig.addcontact('testcontact', group_name='testinggroup')

        contacts = Model.Contact.objects.filter(contact_name='testcontact')

        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('testinggroup', contacts[0].contactgroups)
Esempio n. 3
0
    def test_email(self):
        """Contact with email"""
        okconfig.addcontact('testcontact', email="*****@*****.**")

        contacts = Model.Contact.objects.filter(contact_name='testcontact')

        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('*****@*****.**', contacts[0].email)
Esempio n. 4
0
    def test_force(self):
        """Add contact overwriting a previous one"""
        okconfig.addcontact('testcontact', 'Should be replaced')
        okconfig.addcontact('testcontact', 'With this one', force=True)

        contacts = Model.Contact.objects.filter(contact_name='testcontact', )
        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('With this one', contacts[0].alias)
Esempio n. 5
0
    def test_basic(self):
        """Add a contact"""
        okconfig.addcontact("testcontact")

        contacts = Model.Contact.objects.filter(
            contact_name='testcontact'
        )
        self.assertEqual(1, len(contacts), 'There can be only one')
Esempio n. 6
0
    def test_alias(self):
        """Add contact with alias"""
        okconfig.addcontact('testcontact', alias="Test Contact")

        contacts = Model.Contact.objects.filter(contact_name='testcontact',
                                                alias='Test Contact')
        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('Test Contact', contacts[0].alias)
Esempio n. 7
0
    def test_use(self):
        """Contact with use statement"""
        okconfig.addcontact('testcontact', use="okc-contact")

        contacts = Model.Contact.objects.filter(
            contact_name='testcontact')

        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('okc-contact', contacts[0].use)
Esempio n. 8
0
    def test_email(self):
        """Contact with email"""
        okconfig.addcontact('testcontact', email="*****@*****.**")

        contacts = Model.Contact.objects.filter(
            contact_name='testcontact')

        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('*****@*****.**', contacts[0].email)
Esempio n. 9
0
    def test_withgroup(self):
        """Make a contact within a group"""
        okconfig.addcontact('testcontact', group_name='testinggroup')

        contacts = Model.Contact.objects.filter(
            contact_name='testcontact')

        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('testinggroup', contacts[0].contactgroups)
Esempio n. 10
0
    def test_force(self):
        """Add contact overwriting a previous one"""
        okconfig.addcontact('testcontact', 'Should be replaced')
        okconfig.addcontact('testcontact', 'With this one', force=True)

        contacts = Model.Contact.objects.filter(
            contact_name='testcontact',
        )
        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('With this one', contacts[0].alias)
Esempio n. 11
0
    def test_alias(self):
        """Add contact with alias"""
        okconfig.addcontact('testcontact', alias="Test Contact")

        contacts = Model.Contact.objects.filter(
            contact_name='testcontact',
            alias='Test Contact'
        )
        self.assertEqual(1, len(contacts), 'There can be only one')
        self.assertEqual('Test Contact', contacts[0].alias)
Esempio n. 12
0
 def test_conflict(self):
     """Make sure we raise on conflict"""
     okconfig.addcontact('testcontact', 'should be ok')
     self.assertRaises(okconfig.OKConfigError, okconfig.addcontact,
                       'testcontact', 'but this one not')
Esempio n. 13
0
    def test_basic(self):
        """Add a contact"""
        okconfig.addcontact("testcontact")

        contacts = Model.Contact.objects.filter(contact_name='testcontact')
        self.assertEqual(1, len(contacts), 'There can be only one')
Esempio n. 14
0
 def test_conflict(self):
     """Make sure we raise on conflict"""
     okconfig.addcontact('testcontact', 'should be ok')
     self.assertRaises(okconfig.OKConfigError, okconfig.addcontact,
                       'testcontact', 'but this one not')