# Path: dnsforever/config.py



from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, Unicode, Boolean, DateTime, \
    UnicodeText
from sqlalchemy import ForeignKey
from sqlalchemy.orm import sessionmaker, validates, relationship
from sqlalchemy.sql import functions
from sqlalchemy.ext.declarative import declarative_base
from dnsforever.config import database_url, webforwarding_domain
import re
import unittest
import string
import random
            s.add(record)

        record = s.query(Record).filter(Record.domain==domain)\
                                .filter(Record.name=='ddnsa')\
                                .filter(Record.type=='A').first()

        self.assertEqual(record.name, 'ddnsa')
        self.assertEqual(record.type, 'A')
        self.assertEqual(record.rdata, '127.0.0.1')

        key1 = record.ddns_key
        record.reset_key()
        key2 = record.ddns_key
        self.assertNotEqual(key1, key2)

    def test_record_webforwarding(self):
        s = Session()
        domain = s.query(Domain).filter(User.id==self.domain_id).first()
        self.assertIsNotNone(domain)

        record = RecordWebForwarding(domain=domain, name='webforwarding', target_url='http://dnsforever.kr/')

        with s.begin():
            s.add(record)

        record = s.query(Record).filter(Record.domain==domain)\
                                .filter(Record.name=='webforwarding').first()

        self.assertEqual(record.name, 'webforwarding')
        self.assertEqual(record.type, 'CNAME')

# Path: dnsforever/config.py



# Path: dnsforever/models.py
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, Unicode, Boolean, DateTime, \
    UnicodeText
from sqlalchemy import ForeignKey
from sqlalchemy.orm import sessionmaker, validates, relationship
from sqlalchemy.sql import functions
from sqlalchemy.ext.declarative import declarative_base
from dnsforever.config import database_url, webforwarding_domain
import re
import unittest
import string
import random

            s.add(record)

        record = s.query(Record).filter(Record.domain==domain)\
                                .filter(Record.name=='ddnsa')\
                                .filter(Record.type=='A').first()

        self.assertEqual(record.name, 'ddnsa')
        self.assertEqual(record.type, 'A')
        self.assertEqual(record.rdata, '127.0.0.1')

        key1 = record.ddns_key
        record.reset_key()
        key2 = record.ddns_key
        self.assertNotEqual(key1, key2)

    def test_record_webforwarding(self):
        s = Session()
        domain = s.query(Domain).filter(User.id==self.domain_id).first()
        self.assertIsNotNone(domain)

        record = RecordWebForwarding(domain=domain, name='webforwarding', target_url='http://dnsforever.kr/')

        with s.begin():
            s.add(record)

        record = s.query(Record).filter(Record.domain==domain)\
                                .filter(Record.name=='webforwarding').first()

        self.assertEqual(record.name, 'webforwarding')
        self.assertEqual(record.type, 'CNAME')

        self.assertEqual(record.rdata, webforwarding_domain)