<s> import random <EOL> import string <EOL> from mozdns . create_zone . views import create_zone_ajax <EOL> from django . test import RequestFactory <EOL> def get_post_data ( random_str , suffix ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> '<STR_LIT>' : '<STR_LIT>' . format ( random_str , suffix ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> def create_fake_zone ( random_str , suffix = "<STR_LIT>" ) : <EOL> factory = RequestFactory ( ) <EOL> post_data = get_post_data ( random_str , suffix = suffix ) <EOL> request = factory . post ( "<STR_LIT>" , post_data ) <EOL> create_zone_ajax ( request ) <EOL> from mozdns . domain . models import Domain <EOL> return Domain . objects . get ( name = post_data [ '<STR_LIT>' ] ) <EOL> def random_label ( ) : <EOL> """<STR_LIT>""" <EOL> label = '<STR_LIT>' <EOL> for i in range ( random . randint ( <NUM_LIT:5> , <NUM_LIT:30> ) ) : <EOL> label += string . letters [ random . randint ( <NUM_LIT:0> , len ( string . letters ) - <NUM_LIT:1> ) ] <EOL> return label <EOL> def random_byte ( ) : <EOL> """<STR_LIT>""" <EOL> return random . randint ( <NUM_LIT:1> , <NUM_LIT:255> ) </s>
