Example #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)
Example #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)
Example #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)
Example #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)
Example #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')
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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')
Example #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')
Example #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')