Пример #1
0
class APINameTest(unittest.TestCase):
    """
        Tests for APIName class main functionalities
    """

    def setUp(self):
        self.domain = "test.com"
        self.record = DNSRecord(domain=self.domain, hostname="www.test.com", content="test2.com", record_id="1")

    ##############################################################
    # DNSRecord tests
    ##############################################################
    def test_post_data(self):
        "Test post_data DNSRecord method"
        _result = {"hostname": "www.test.com", "priority": None, "content": "test2.com", "ttl": 300, "type": "CNAME"}
        self.assertEqual(_result, self.record.post_data())

    def test_create_from_raw(self):
        "Test create_from_raw DNSRecord method"
        _raw_dict = {
            "record_id": "1",
            "name": "www.test.com",
            "type": "CNAME",
            "content": "test2.com",
            "ttl": 300,
            "priority": None,
            "domain": "test.com",
        }
        _record = DNSRecord.create_from_raw(_raw_dict)
        for _fd in ["domain", "hostname", "content", "record_id"]:
            self.assertEqual(getattr(self.record, _fd), getattr(_record, _fd))
Пример #2
0
class APINameTest(unittest.TestCase):
    """
        Tests for APIName class main functionalities
    """
    def setUp(self):
        self.domain = 'test.com'
        self.record = DNSRecord(domain=self.domain, hostname='www.test.com', \
            content='test2.com', record_id='1')

    ##############################################################
    # DNSRecord tests
    ##############################################################
    def test_post_data(self):
        "Test post_data DNSRecord method"
        _result = {'hostname': 'www.test.com', 'priority': None,
            'content': 'test2.com', 'ttl': 300, 'type': 'CNAME'}
        self.assertEqual(_result, self.record.post_data())

    def test_create_from_raw(self):
        "Test create_from_raw DNSRecord method"
        _raw_dict = {'record_id': '1', 'name': 'www.test.com', 'type': 'CNAME',
            'content': 'test2.com', 'ttl': 300, 'priority': None,
            'domain': 'test.com'}
        _record = DNSRecord.create_from_raw(_raw_dict)
        for _fd in ['domain', 'hostname', 'content', 'record_id']:
            self.assertEqual(getattr(self.record, _fd), getattr(_record, _fd))
Пример #3
0
 def test_create_from_raw(self):
     "Test create_from_raw DNSRecord method"
     _raw_dict = {'record_id': '1', 'name': 'www.test.com', 'type': 'CNAME',
         'content': 'test2.com', 'ttl': 300, 'priority': None,
         'domain': 'test.com'}
     _record = DNSRecord.create_from_raw(_raw_dict)
     for _fd in ['domain', 'hostname', 'content', 'record_id']:
         self.assertEqual(getattr(self.record, _fd), getattr(_record, _fd))
Пример #4
0
 def test_create_from_raw(self):
     "Test create_from_raw DNSRecord method"
     _raw_dict = {
         "record_id": "1",
         "name": "www.test.com",
         "type": "CNAME",
         "content": "test2.com",
         "ttl": 300,
         "priority": None,
         "domain": "test.com",
     }
     _record = DNSRecord.create_from_raw(_raw_dict)
     for _fd in ["domain", "hostname", "content", "record_id"]:
         self.assertEqual(getattr(self.record, _fd), getattr(_record, _fd))
Пример #5
0
 def setUp(self):
     self.domain = "test.com"
     self.record = DNSRecord(domain=self.domain, hostname="www.test.com", content="test2.com", record_id="1")
Пример #6
0
 def setUp(self):
     self.domain = 'test.com'
     self.record = DNSRecord(domain=self.domain, hostname='www.test.com', \
         content='test2.com', record_id='1')