def test_delete(self): ''' Test for Remove specific function contents of minion. Returns True on success. ''' with patch.dict(mine.__opts__, {'file_client': 'local', 'id': 'id'}): with patch.dict( mine.__salt__, { 'data.getval': MagicMock(return_value={'A': 'B'}), 'data.update': MagicMock(return_value='A') }): self.assertEqual(mine.delete('fun'), 'A') with patch.dict(mine.__opts__, {'file_client': 'local1', 'id': 'id'}): with patch.object(mine, '_mine_send', return_value='A'): self.assertEqual(mine.delete('fun'), 'A')
def test_delete(self): ''' Test for Remove specific function contents of minion. Returns True on success. ''' with patch.dict(mine.__opts__, {'file_client': 'local', 'id': 'id'}): with patch.dict(mine.__salt__, {'data.getval': MagicMock(return_value={'A': 'B'}), 'data.update': MagicMock(return_value='A')}): self.assertEqual(mine.delete('fun'), 'A') with patch.dict(mine.__opts__, {'file_client': 'local1', 'id': 'id'}): with patch.object(mine, '_mine_send', return_value='A'): self.assertEqual(mine.delete('fun'), 'A')
def test_delete_local(self): """ Tests the ``delete``-function on the minion's local cache. """ # Prefill minion cache with a non-ACL value self.cache.store("minions/webserver", "mine_cache", {"foobard": "barfood"}) with patch.dict(mine.__opts__, {"file_client": "local", "id": "webserver"}): ret = mine.delete("foobard") self.assertEqual(self.cache.fetch("minions/webserver", "mine_cache"), {})
def test_delete_local(self): ''' Tests the ``delete``-function on the minion's local cache. ''' # Prefill minion cache with a non-ACL value self.cache.store('minions/webserver', 'mine_cache', {'foobard': 'barfood'}) with patch.dict(mine.__opts__, { 'file_client': 'local', 'id': 'webserver', }): ret = mine.delete('foobard') self.assertEqual( self.cache.fetch('minions/webserver', 'mine_cache'), {})
def test_delete_master(self): """ Tests whether the ``delete``-function sends the correct data to the master. """ # Prefill minion cache with a non-ACL value self.cache.store("minions/webserver", "mine_cache", {"foobard": "barfood"}) mock_load = { "cmd": "_mine_delete", "fun": "foobard", "id": "foo", } with patch.object( mine, "_mine_send", MagicMock(side_effect=lambda x, y: x) ), patch.dict(mine.__opts__, {"file_client": "remote", "id": "foo"}): # Verify the correct load self.assertEqual(mine.delete("foobard"), mock_load)
def test_delete_master(self): ''' Tests whether the ``delete``-function sends the correct data to the master. ''' # Prefill minion cache with a non-ACL value self.cache.store('minions/webserver', 'mine_cache', {'foobard': 'barfood'}) mock_load = { 'cmd': '_mine_delete', 'fun': 'foobard', 'id': 'foo', } with patch.object(mine, '_mine_send', MagicMock(side_effect=lambda x, y: x)),\ patch.dict(mine.__opts__, { 'file_client': 'remote', 'id': 'foo', }): # Verify the correct load self.assertEqual(mine.delete('foobard'), mock_load)