<s> """<STR_LIT>""" <EOL> from django . contrib . auth . models import User <EOL> from powerdns . models . powerdns import Domain , Record <EOL> from powerdns . tests . utils import RecordFactory , RecordTestCase <EOL> from powerdns . models . requests import RecordRequest <EOL> from powerdns . utils import AutoPtrOptions <EOL> class TestRequestUniquenessConstraints ( RecordTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestRequestUniquenessConstraints , self ) . setUp ( ) <EOL> self . a_record = RecordFactory ( <EOL> domain = self . domain , <EOL> type = '<STR_LIT:A>' , <EOL> name = '<STR_LIT>' , <EOL> content = '<STR_LIT>' , <EOL> auto_ptr = AutoPtrOptions . NEVER , <EOL> ) <EOL> self . cname_record = RecordFactory ( <EOL> domain = self . domain , <EOL> type = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> content = '<STR_LIT>' , <EOL> ) <EOL> self . user = User . objects . create_user ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:password>' <EOL> ) <EOL> def tearDown ( self ) : <EOL> for Model in [ Domain , Record , User ] : <EOL> Model . objects . all ( ) . delete ( ) <EOL> def validate ( self , ** values ) : <EOL> """<STR_LIT>""" <EOL> values . setdefault ( '<STR_LIT>' , self . domain ) <EOL> RecordRequest ( ** values ) . full_clean ( ) <EOL> def test_nonconflicting_a_record ( self ) : <EOL> """<STR_LIT>""" <EOL> self . validate ( <EOL> target_type = '<STR_LIT:A>' , <EOL> target_name = '<STR_LIT>' , <EOL> target_content = '<STR_LIT>' , <EOL> target_owner = self . user , <EOL> ) <EOL> def test_noconflict_with_itself ( self ) : <EOL> """<STR_LIT>""" <EOL> self . validate ( <EOL> record = self . cname_record , <EOL> target_type = '<STR_LIT>' , <EOL> target_name = '<STR_LIT>' , <EOL> target_content = '<STR_LIT>' , <EOL> target_owner = self . user , <EOL> ) <EOL> def test_conflicting_a_record ( self ) : <EOL> """<STR_LIT>""" <EOL> self . check_invalid ( <EOL> target_type = '<STR_LIT:A>' , <EOL> target_name = '<STR_LIT>' , <EOL> target_content = '<STR_LIT>' , <EOL> target_owner = self . user , <EOL> ) <EOL> def test_nonconflicting_cname_record ( self ) : <EOL> """<STR_LIT>""" <EOL> self . validate ( <EOL> target_type = '<STR_LIT>' , <EOL> target_name = '<STR_LIT>' , <EOL> target_content = '<STR_LIT>' , <EOL> target_owner = self . user , <EOL> ) <EOL> def test_conflicting_cname_record ( self ) : <EOL> """<STR_LIT>""" <EOL> self . check_invalid ( <EOL> target_type = '<STR_LIT>' , <EOL> target_name = '<STR_LIT>' , <EOL> target_content = '<STR_LIT>' , <EOL> target_owner = self . user , <EOL> ) <EOL> def test_conflicting_second_cname_record ( self ) : <EOL> """<STR_LIT>""" <EOL> self . check_invalid ( <EOL> target_type = '<STR_LIT>' , <EOL> target_name = '<STR_LIT>' , <EOL> target_content = '<STR_LIT>' , <EOL> target_owner = self . user , <EOL> ) </s>
