コード例 #1
0
ファイル: test_netdevices.py プロジェクト: zonda80/trigger
 def test_string_operations(self):
     """Test string output and comparison behaviors"""
     # String comparisons
     expected = 'cisco'
     self.assertEqual(expected, self.vendor.normalized)
     self.assertEqual(expected, str(self.vendor))
     self.assertEqual(expected, Vendor(expected))
     # Title casing
     expected = 'Cisco'
     self.assertEqual(expected, self.vendor.title)
     self.assertEqual(expected.lower(), self.vendor.lower())
     # Mfr equates to object
     self.assertEqual(self.mfr, self.vendor)
コード例 #2
0
ファイル: test_netdevices.py プロジェクト: zonda80/trigger
class TestVendorObject(unittest.TestCase):
    """Test Vendor object"""
    def setUp(self):
        self.mfr = 'CISCO SYSTEMS'
        self.vendor = Vendor(self.mfr)

    def test_creation(self):
        """Test creation of a Vendor instance"""
        expected = 'cisco'
        self.assertEqual(expected, self.vendor)

    def test_string_operations(self):
        """Test string output and comparison behaviors"""
        # String comparisons
        expected = 'cisco'
        self.assertEqual(expected, self.vendor.normalized)
        self.assertEqual(expected, str(self.vendor))
        self.assertEqual(expected, Vendor(expected))
        # Title casing
        expected = 'Cisco'
        self.assertEqual(expected, self.vendor.title)
        self.assertEqual(expected.lower(), self.vendor.lower())
        # Mfr equates to object
        self.assertEqual(self.mfr, self.vendor)

    def test_membership(self):
        """Test membership w/ __eq__ and __contains__"""
        expected = 'cisco'
        self.assertTrue(expected in [self.vendor])
        self.assertTrue(self.vendor in [self.vendor])
        self.assertTrue(self.vendor in [expected])
        self.assertFalse(self.vendor in ['juniper', 'foundry'])

    def test_determine_vendor(self):
        """Test determine_vendor() method"""
        expected = 'cisco'
        self.assertEqual(expected, self.vendor.determine_vendor(self.mfr))
コード例 #3
0
class TestVendorObject(unittest.TestCase):
    """Test Vendor object"""
    def setUp(self):
        self.mfr = 'CISCO SYSTEMS'
        self.vendor = Vendor(self.mfr)

    def test_creation(self):
        """Test creation of a Vendor instance"""
        expected = 'cisco'
        self.assertEqual(expected, self.vendor)

    def test_string_operations(self):
        """Test string output and comparison behaviors"""
        # String comparisons
        expected = 'cisco'
        self.assertEqual(expected, self.vendor.normalized)
        self.assertEqual(expected, str(self.vendor))
        self.assertEqual(expected, Vendor(expected))
        # Title casing
        expected = 'Cisco'
        self.assertEqual(expected, self.vendor.title)
        self.assertEqual(expected.lower(), self.vendor.lower())
        # Mfr equates to object
        self.assertEqual(self.mfr, self.vendor)

    def test_membership(self):
        """Test membership w/ __eq__ and __contains__"""
        expected = 'cisco'
        self.assertTrue(expected in [self.vendor])
        self.assertTrue(self.vendor in [self.vendor])
        self.assertTrue(self.vendor in [expected])
        self.assertFalse(self.vendor in ['juniper', 'foundry'])

    def test_determine_vendor(self):
        """Test determine_vendor() method"""
        expected = 'cisco'
        self.assertEqual(expected, self.vendor.determine_vendor(self.mfr))
コード例 #4
0
ファイル: test_netdevices.py プロジェクト: zonda80/trigger
 def setUp(self):
     self.mfr = 'CISCO SYSTEMS'
     self.vendor = Vendor(self.mfr)
コード例 #5
0
 def setUp(self):
     self.mfr = 'CISCO SYSTEMS'
     self.vendor = Vendor(self.mfr)