Esempio n. 1
0
def test_integer_property_accesses_resource_id(mocker):
    mocker.patch('lets_do_dns.do_domain.resource.requests.post')
    mocker.patch('lets_do_dns.do_domain.resource.Response.__init__',
                 return_value=None)

    mock_resource_id = mocker.patch(
        'lets_do_dns.do_domain.resource.Response.resource_id',
        new_callable=PropertyMock)

    resource = Resource('stub-api-key', 'stub-host', 'stub-domain')
    resource.create()
    resource.__int__()

    mock_resource_id.assert_called_once()
Esempio n. 2
0
def test_stores_integer_identifier(mocker, input_record_id):
    mocker.patch('lets_do_dns.do_domain.resource.requests.post')
    mocker.patch('lets_do_dns.do_domain.resource.Response.__init__',
                 return_value=None)
    mocker.patch('lets_do_dns.do_domain.resource.Response.resource_id',
                 new_callable=PropertyMock,
                 return_value=input_record_id)

    resource = Resource('stub-api-key', 'stub-host', 'stub-domain')
    resource.create()
    output_record_id = resource.__int__()

    assert output_record_id == input_record_id