test_delete_txt_record changed to mock get_zone_name and return the value directly instead of executing the function.
This commit is contained in:
parent
31c2d207a2
commit
37a1b55b08
|
@ -396,30 +396,12 @@ class TestAcme(unittest.TestCase):
|
||||||
@patch("lemur.extensions.metrics")
|
@patch("lemur.extensions.metrics")
|
||||||
def test_delete_txt_record(self, mock_metrics, mock_current_app):
|
def test_delete_txt_record(self, mock_metrics, mock_current_app):
|
||||||
domain = "_acme_challenge.test.example.com"
|
domain = "_acme_challenge.test.example.com"
|
||||||
|
zone = "test.example.com"
|
||||||
token = "ABCDEFGHIJ"
|
token = "ABCDEFGHIJ"
|
||||||
account_number = "1234567890"
|
account_number = "1234567890"
|
||||||
change_id = (domain, token)
|
change_id = (domain, token)
|
||||||
path = "a/b/c"
|
|
||||||
paginate_response = [{'properties': {'name': 'example.com.', 'accountName': 'netflix', 'type': 'PRIMARY',
|
|
||||||
'dnssecStatus': 'UNSIGNED', 'status': 'ACTIVE', 'resourceRecordCount': 9,
|
|
||||||
'lastModifiedDateTime': '2017-06-14T06:45Z'}, 'registrarInfo': {
|
|
||||||
'nameServers': {'missing': ['pdns154.ultradns.com.', 'pdns154.ultradns.net.', 'pdns154.ultradns.biz.',
|
|
||||||
'pdns154.ultradns.org.']}}, 'inherit': 'ALL'},
|
|
||||||
{'properties': {'name': 'test.example.com.', 'accountName': 'netflix', 'type': 'PRIMARY',
|
|
||||||
'dnssecStatus': 'UNSIGNED', 'status': 'ACTIVE', 'resourceRecordCount': 9,
|
|
||||||
'lastModifiedDateTime': '2017-06-14T06:45Z'}, 'registrarInfo': {
|
|
||||||
'nameServers': {'missing': ['pdns154.ultradns.com.', 'pdns154.ultradns.net.',
|
|
||||||
'pdns154.ultradns.biz.', 'pdns154.ultradns.org.']}},
|
|
||||||
'inherit': 'ALL'},
|
|
||||||
{'properties': {'name': 'example2.com.', 'accountName': 'netflix', 'type': 'SECONDARY',
|
|
||||||
'dnssecStatus': 'UNSIGNED', 'status': 'ACTIVE', 'resourceRecordCount': 9,
|
|
||||||
'lastModifiedDateTime': '2017-06-14T06:45Z'}, 'registrarInfo': {
|
|
||||||
'nameServers': {'missing': ['pdns154.ultradns.com.', 'pdns154.ultradns.net.',
|
|
||||||
'pdns154.ultradns.biz.', 'pdns154.ultradns.org.']}},
|
|
||||||
'inherit': 'ALL'}]
|
|
||||||
ultradns._paginate = Mock(path, "zones")
|
|
||||||
ultradns._paginate.side_effect = [[paginate_response]]
|
|
||||||
mock_current_app.logger.debug = Mock()
|
mock_current_app.logger.debug = Mock()
|
||||||
|
ultradns.get_zone_name = Mock(return_value=zone)
|
||||||
ultradns._post = Mock()
|
ultradns._post = Mock()
|
||||||
ultradns._get = Mock()
|
ultradns._get = Mock()
|
||||||
ultradns._get.return_value = {'zoneName': 'test.example.com.com',
|
ultradns._get.return_value = {'zoneName': 'test.example.com.com',
|
||||||
|
|
Loading…
Reference in New Issue