Example #1
0
    def test_stp(self):
        """
        Test for Sets Spanning Tree Protocol state for a bridge
        """
        with patch.dict(bridge.__grains__, {"kernel": "Linux"}):
            mock = MagicMock(return_value="Linux")
            with patch.object(bridge, "_os_dispatch", mock):
                self.assertEqual(bridge.stp(), "Linux")

        with patch.dict(bridge.__grains__, {"kernel": "FreeBSD"}):
            mock = MagicMock(return_value="FreeBSD")
            with patch.object(bridge, "_os_dispatch", mock):
                self.assertEqual(bridge.stp(), "FreeBSD")

        with patch.dict(bridge.__grains__, {"kernel": None}):
            self.assertFalse(bridge.stp())
Example #2
0
    def test_stp(self):
        '''
        Test for Sets Spanning Tree Protocol state for a bridge
        '''
        with patch.dict(bridge.__grains__, {'kernel': 'Linux'}):
            mock = MagicMock(return_value='Linux')
            with patch.object(bridge, '_os_dispatch', mock):
                self.assertEqual(bridge.stp(), 'Linux')

        with patch.dict(bridge.__grains__, {'kernel': 'FreeBSD'}):
            mock = MagicMock(return_value='FreeBSD')
            with patch.object(bridge, '_os_dispatch', mock):
                self.assertEqual(bridge.stp(), 'FreeBSD')

        with patch.dict(bridge.__grains__, {'kernel': None}):
            self.assertFalse(bridge.stp())
Example #3
0
    def test_stp(self):
        '''
        Test for Sets Spanning Tree Protocol state for a bridge
        '''
        with patch.dict(bridge.__grains__, {'kernel': 'Linux'}):
            mock = MagicMock(return_value='Linux')
            with patch.object(bridge, '_os_dispatch', mock):
                self.assertEqual(bridge.stp(), 'Linux')

        with patch.dict(bridge.__grains__, {'kernel': 'FreeBSD'}):
            mock = MagicMock(return_value='FreeBSD')
            with patch.object(bridge, '_os_dispatch', mock):
                self.assertEqual(bridge.stp(), 'FreeBSD')

        with patch.dict(bridge.__grains__, {'kernel': None}):
            self.assertFalse(bridge.stp())