def test_group_add_owner_new(self): '''this function tests the group_add_owner method for a valid user not already owner of the group''' self.client.create(self.group_name) group_already_exists, success = \ group_validate(self.group_name, '', self.client) group_already_owner_start = group_already_owner('magarvey', self.group_name, self.client) try: subscribed, owner = group_add_owner('magarvey', self.group_name, self.client) group_add_owner_success = True except: group_add_owner_success = False group_already_exists, success = \ group_validate(self.group_name, '', self.client) sleep(5) group_already_owner_end = group_already_owner('magarvey', self.group_name, self.client) '''DEBUGGIN''' print str(self.client.status(self.group_name)) print str(group_already_owner('magarvey',self.group_name,self.client)) assert group_already_exists assert (group_already_owner_start == False) assert (success == False) assert group_add_owner_success assert subscribed assert owner assert group_already_owner_end
def test_group_validate_existing(self): '''this function tests running group_validate on a known existing group''' group_already_exists, success = \ group_validate('abc_group', '', self.client) assert (group_already_exists == True) assert (success == False)
def test_group_add_owner_existing(self): '''this function tests the group_add_owner method on a group that the user is already owner of''' group_already_exists, success = \ group_validate('abc_calendar', '', self.client) group_already_owner_start = group_already_owner('magarvey', 'abc_group', self.client) try: group_add_owner('magarvey', 'abc_group', self.client) group_add_owner_success = True except: group_add_owner_success = False group_already_owner_end = group_already_owner('magarvey','abc_group',self.client) assert group_already_exists assert group_already_owner_start assert group_already_owner_end assert (success == False) assert (group_add_owner_success == True)
def test_group_add_owner_invalid(self): '''this function tests the group_add_owner method on a user that is not in the gtest.pdx.edu system''' group_already_exists, success = \ group_validate('abc_group', '', self.client) try: group_already_owner_start = group_already_owner('?//%/$/#@', 'abc_group', self.client) except: group_already_owner_start = False try: subscribed, owner = group_add_owner('?//%/$/#@', 'abc_group', self.client) group_add_owner_success = True except: group_add_owner_success = False assert group_already_exists assert (group_already_owner_start == False) assert (success == False) assert (group_add_owner_success == True) assert (subscribed == False) assert (owner == False)
elif (u'group_name' in request.POST.keys()): form = GroupForm( request.POST ) #check if form valid if not form.is_valid(): return HttpResponse("form not valid...") #handle form submission else: group_name = form.cleaned_data['group_name'] group_description = form.cleaned_data['group_description'] group_requestor_1 = form.cleaned_data['group_requestor_1'] group_requestor_2 = form.cleaned_data['group_requestor_2'] try: #client = Group( google.keys()[0] ) client = Group(domain=group.keys()[0],adminuser=group[group.keys()[0]]['adminuser'],password=group[group.keys()[0]]['password']) group_already_exists, success = group_validate( group_name, group_description, client ) #create success message response = process_group( group_name, group_description, group_already_exists, success ) if group_requestor_1: try: if requestor_validate( group_requestor_1, client ): requestor_1_already_owner = group_already_owner( group_requestor_1, group_name, client ) response += group_process_requestor(
def test_group_validate_new(self): '''this function tests running calendar_validate on a new calendar''' group_already_exists, success = \ group_validate(self.group_name, '', self.client) assert (group_already_exists == False) assert (success == True)