test_create_txt_record modified - get_zone_name mocked to return the zone name directly, instead of actually running the function.

This commit is contained in:
Kush Bavishi 2019-08-07 13:20:24 -07:00
parent f2cbddf9e2
commit 785c1ca73e
1 changed files with 2 additions and 21 deletions

View File

@ -377,29 +377,10 @@ class TestAcme(unittest.TestCase):
@patch("lemur.plugins.lemur_acme.ultradns.current_app") @patch("lemur.plugins.lemur_acme.ultradns.current_app")
def test_create_txt_record(self, mock_current_app): def test_create_txt_record(self, 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"
path = "a/b/c" ultradns.get_zone_name = Mock(return_value=zone)
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._post = Mock() ultradns._post = Mock()
log_data = { log_data = {