<s> from django . test import TestCase <EOL> from django . core . exceptions import ValidationError <EOL> from core . registration . static . models import StaticReg <EOL> from systems . tests . utils import create_fake_host <EOL> from mozdns . view . models import View <EOL> from mozdns . tests . utils import create_fake_zone <EOL> class StaticRegDecommissionTests ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . s = create_fake_host ( hostname = '<STR_LIT>' ) <EOL> self . domain = create_fake_zone ( "<STR_LIT>" , suffix = "<STR_LIT>" ) <EOL> create_fake_zone ( "<STR_LIT>" , suffix = "<STR_LIT>" ) <EOL> View . objects . get_or_create ( name = "<STR_LIT>" ) <EOL> def test_decommision ( self ) : <EOL> sreg = StaticReg . objects . create ( <EOL> label = '<STR_LIT>' , domain = self . domain , system = self . s , <EOL> ip_type = '<STR_LIT:4>' , ip_str = '<STR_LIT>' <EOL> ) <EOL> sreg . decommissioned = True <EOL> sreg . save ( ) <EOL> self . assertTrue ( sreg . fqdn . startswith ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( sreg . ip_str != '<STR_LIT>' ) <EOL> sreg . full_clean ( ) <EOL> sreg . bind_render_record ( ) <EOL> def test_recommision ( self ) : <EOL> sreg = StaticReg . objects . create ( <EOL> label = '<STR_LIT>' , domain = self . domain , system = self . s , <EOL> ip_type = '<STR_LIT:4>' , ip_str = '<STR_LIT>' <EOL> ) <EOL> sreg . decommissioned = True <EOL> sreg . save ( ) <EOL> sreg . decommissioned = False <EOL> self . assertRaises ( ValidationError , sreg . save ) <EOL> sreg . label = '<STR_LIT>' <EOL> sreg . domain = self . domain <EOL> self . assertRaises ( ValidationError , sreg . save ) <EOL> sreg . ip_str = '<STR_LIT>' <EOL> sreg . save ( ) </s>
