mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-28 11:09:52 +00:00
44 lines
861 B
Python
44 lines
861 B
Python
import pytest
|
|
|
|
from openapi_core.extensions.models.models import BaseModel, Model
|
|
|
|
|
|
class TestBaseModelDict(object):
|
|
|
|
def test_not_implemented(self):
|
|
model = BaseModel()
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
model.__dict__
|
|
|
|
|
|
class TestModelDict(object):
|
|
|
|
def test_dict_empty(self):
|
|
model = Model()
|
|
|
|
result = model.__dict__
|
|
|
|
assert result == {}
|
|
|
|
def test_dict(self):
|
|
properties = {
|
|
'prop1': 'value1',
|
|
'prop2': 'value2',
|
|
}
|
|
model = Model(properties)
|
|
|
|
result = model.__dict__
|
|
|
|
assert result == properties
|
|
|
|
def test_attribute(self):
|
|
prop_value = 'value1'
|
|
properties = {
|
|
'prop1': prop_value,
|
|
}
|
|
model = Model(properties)
|
|
|
|
result = model.prop1
|
|
|
|
assert result == prop_value
|