Пример #1
0
def test_new_set():
    """
    Test for Create new custom set
    """
    assert ipset.new_set() == "Error: Set Name needs to be specified"

    assert ipset.new_set("s") == "Error: Set Type needs to be specified"

    assert ipset.new_set("s", "d") == "Error: Set Type is invalid"

    assert ipset.new_set("s",
                         "bitmap:ip") == "Error: range is a required argument"

    mock = MagicMock(return_value=False)
    with patch.dict(ipset.__salt__, {"cmd.run": mock}):
        assert ipset.new_set("s", "bitmap:ip", range="range")
Пример #2
0
    def test_new_set(self):
        '''
        Test for Create new custom set
        '''
        self.assertEqual(ipset.new_set(), 'Error: Set needs to be specified')

        self.assertEqual(ipset.new_set('s'),
                         'Error: Set Type needs to be specified')

        self.assertEqual(ipset.new_set('s', 'd'), 'Error: Set Type is invalid')

        self.assertEqual(ipset.new_set('s', 'bitmap:ip'),
                         'Error: range is a required argument')

        mock = MagicMock(return_value=False)
        with patch.dict(ipset.__salt__, {'cmd.run': mock}):
            self.assertTrue(ipset.new_set('s', 'bitmap:ip', range='range'))
Пример #3
0
    def test_new_set(self):
        '''
        Test for Create new custom set
        '''
        self.assertEqual(ipset.new_set(), 'Error: Set needs to be specified')

        self.assertEqual(ipset.new_set('s'),
                         'Error: Set Type needs to be specified')

        self.assertEqual(ipset.new_set('s', 'd'), 'Error: Set Type is invalid')

        self.assertEqual(ipset.new_set('s', 'bitmap:ip'),
                         'Error: range is a required argument')

        mock = MagicMock(return_value=False)
        with patch.dict(ipset.__salt__, {'cmd.run': mock}):
            self.assertTrue(ipset.new_set('s', 'bitmap:ip', range='range'))
Пример #4
0
    def test_new_set(self):
        """
        Test for Create new custom set
        """
        self.assertEqual(ipset.new_set(), "Error: Set needs to be specified")

        self.assertEqual(ipset.new_set("s"),
                         "Error: Set Type needs to be specified")

        self.assertEqual(ipset.new_set("s", "d"), "Error: Set Type is invalid")

        self.assertEqual(ipset.new_set("s", "bitmap:ip"),
                         "Error: range is a required argument")

        mock = MagicMock(return_value=False)
        with patch.dict(ipset.__salt__, {"cmd.run": mock}):
            self.assertTrue(ipset.new_set("s", "bitmap:ip", range="range"))