# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import testtools

from helionsdk.dns.v1 import domain

IDENTIFIER = 'IDENTIFIER'
EXAMPLE = {
    'created_at': '1',
    'email': '2',
    'id': IDENTIFIER,
    'name': '4',
    'serial': '5',
    'ttl': '6',
}


class TestDomain(testtools.TestCase):

    def test_basic(self):
        sut = domain.Domain()
        self.assertEqual('domain', sut.resource_key)
        self.assertEqual('domains', sut.resources_key)
        self.assertEqual('/domains', sut.base_path)
        self.assertEqual('dns', sut.service.service_type)
        self.assertTrue(sut.allow_create)
        self.assertTrue(sut.allow_retrieve)
        self.assertTrue(sut.allow_update)
        self.assertTrue(sut.allow_delete)
        self.assertTrue(sut.allow_list)
        self.assertTrue(sut.put_update)

    def test_make_it(self):
        sut = domain.Domain(EXAMPLE)
        self.assertEqual(EXAMPLE['created_at'], sut.created_at)
        self.assertEqual(EXAMPLE['email'], sut.email)
        self.assertEqual(EXAMPLE['id'], sut.id)
        self.assertEqual(EXAMPLE['name'], sut.name)
        self.assertEqual(EXAMPLE['serial'], sut.serial)
        self.assertEqual(EXAMPLE['ttl'], sut.ttl)
