| Total Complexity | 2 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """kytos.cli.commands.web.api.WebAPI tests.""" |
||
| 2 | import unittest |
||
| 3 | from unittest.mock import patch |
||
| 4 | |||
| 5 | from kytos.cli.commands.web.api import WebAPI |
||
| 6 | from kytos.utils.config import KytosConfig |
||
| 7 | |||
| 8 | |||
| 9 | class TestWebAPI(unittest.TestCase): |
||
| 10 | """Test the class WebAPI.""" |
||
| 11 | |||
| 12 | def setUp(self): |
||
| 13 | """Execute steps before each tests.""" |
||
| 14 | self.web_api = WebAPI() |
||
| 15 | |||
| 16 | @patch('requests.post') |
||
| 17 | def test_update(self, mock_post): |
||
| 18 | """Test update method.""" |
||
| 19 | args = {'<version>': 'ABC'} |
||
| 20 | self.web_api.update(args) |
||
| 21 | |||
| 22 | kytos_api = KytosConfig().config.get('kytos', 'api') |
||
| 23 | url = f"{kytos_api}api/kytos/core/web/update/ABC" |
||
| 24 | mock_post.assert_called_with(url) |
||
| 25 |