Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Removed using of deprecated assertDictContainsSubset(). #788

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions tests/renderers/test_openapi_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ def setUp(self):

def test_security_definitions_included_when_defined(self):
self.swagger_settings.SECURITY_DEFINITIONS = {'foo': 'bar'}
expected = {
'securityDefinitions': self.swagger_settings.SECURITY_DEFINITIONS
}
self.assertDictContainsSubset(expected, self.sut())
sut = self.sut()
self.assertIn('securityDefinitions', sut)
self.assertEqual(sut['securityDefinitions'], self.swagger_settings.SECURITY_DEFINITIONS)

def test_security_definitions_not_present_when_none(self):
self.swagger_settings.SECURITY_DEFINITIONS = None
Expand Down
8 changes: 4 additions & 4 deletions tests/renderers/test_swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def test_set_context_sets_auth_urls(self):
urls = {'fizz': 'buzz'}
with patch.object(self.sut, 'get_auth_urls', return_value=urls):
self.sut.set_context(data, self.renderer_context)

self.assertDictContainsSubset(urls, self.renderer_context)
self.assertIn('fizz', self.renderer_context)
self.assertEqual(self.renderer_context['fizz'], 'buzz')

def test_set_context_sets_ui_settings(self):
data = MagicMock()
Expand Down Expand Up @@ -136,8 +136,8 @@ def test_get_ui_settings_without_validator_url(self):
def test_validator_url_none_when_set(self):
self.swagger_settings.VALIDATOR_URL = None
result = self.sut.get_ui_settings()

self.assertDictContainsSubset({'validatorUrl': None}, result)
self.assertIn('validatorUrl', result)
self.assertIsNone(result['validatorUrl'])

def test_validator_url_not_present_when_empty_string(self):
"""
Expand Down