def __init__(self, testcase): self.tested_urls = {'get': [], 'post': []} views_attr = give.views.__dict__.keys() self.views_to_see = [] for attr_str in views_attr: attr = give.views.__getattribute__(attr_str) if type(attr).__name__ == 'function' and \ attr.__module__ == 'give.views' and \ not attr_str.startswith('_'): self.views_to_see.append(attr_str) self.client = Client() self.username = randstr(30, True) self.create_user() self.testcase = testcase
def create_user(self): self.user_password = randstr(30, True) self.user = create_user(username=self.username, password=self.user_password) give.models.UserWebsite.objects.create( user=self.user.get_profile(), url='http://example.com')