Skip to content

Commit

Permalink
Add test for get config
Browse files Browse the repository at this point in the history
  • Loading branch information
22quinn committed Jun 25, 2020
1 parent 77edc52 commit c18722d
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions tests/api_connexion/endpoints/test_config_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,38 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import unittest

import pytest
from mock import patch

from airflow.www import app

MOCK_CONF = {
'test': {
'hello': ('world', 'default'),
},
}

class TestGetConfig(unittest.TestCase):

@patch('airflow.api_connexion.endpoints.config_endpoint.conf.as_dict', return_value=MOCK_CONF)
class TestGetConfig:
@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
def setup_class(cls) -> None:
cls.app = app.create_app(testing=True) # type:ignore

def setUp(self) -> None:
def setup_method(self) -> None:
self.client = self.app.test_client() # type:ignore

@pytest.mark.skip(reason="Not implemented yet")
def test_should_response_200(self):
def test_should_response_200(self, monkeypatch):
response = self.client.get("/api/v1/config")
assert response.status_code == 200
expected = {
'sections': [
{
'name': 'test',
'options': [
{'key': 'hello', 'value': 'world', 'source': 'default'},
]
},
]
}
assert response.json == expected

0 comments on commit c18722d

Please sign in to comment.