コード例 #1
0
ファイル: test.py プロジェクト: maxgarvey/psu_gcal
    def test_process_group_error(self):
        '''this function tests running the process_group method on invalid
        input; indicating failure to create group'''
        response = process_group('group_name', '', False, False)
	meaningful_response = response.split('\n')[0]
	print meaningful_response
        assert (meaningful_response == 'could not make group: group_name')
コード例 #2
0
ファイル: test.py プロジェクト: maxgarvey/psu_gcal
    def test_process_group_new(self):
        '''this function tests running the process_group method on a new
        group'''
        response = process_group('group_name', '', False, True)
	meaningful_response = response.split('\n')[0]
	print meaningful_response
        assert (meaningful_response ==  'group name: group_name (new group)')
コード例 #3
0
ファイル: views.py プロジェクト: maxgarvey/psu_gcal
            #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(
                                    group_requestor_1, 
                                    group_name, 
                                    requestor_1_already_owner, 
                                    client )