Пример #1
0
  def setUp(self):
    """Set up required for the view tests.
    """

    # Create a user for sponsor
    email = "*****@*****.**"
    account = users.User(email=email)
    link_id = 'a_sponsor_user'
    name = 'A Sponsor User'
    sponsor_user_properties = {
        'account': account,
        'link_id': link_id,
        'name': name,
        }
    self.sponsor_user = user_logic.updateOrCreateFromFields(
        sponsor_user_properties)

    # Create sponsor role for a_sponsor_user
    link_id = 'a_sponsor'
    name = link_id
    phone = '01234567'
    contact_postalcode = 'A postalcode'
    description = 'A description'
    contact_country = 'United States'
    short_name = 'AS'
    contact_city = 'A city'
    home_page = 'http://www.asponsor.com'
    email = '*****@*****.**'
    sponsor_properties = {
        'link_id': link_id,
        'name': name,
        'short_name': short_name,
        'founder': self.sponsor_user,
        'phone': phone,
        'description': description,
        'contact_country': contact_country,
        'contact_city': contact_city,
        'contact_street': 'A Street',
        'contact_postalcode': contact_postalcode,
        'home_page': home_page,
        'email': email,
        }
    self.sponsor = sponsor_logic.updateOrCreateFromFields(sponsor_properties)

    # Create a timeline for a program
    timeline_properties = {
        'link_id': 'a_program',
        'scope_path': 'a_sponsor',
        'scope': self.sponsor,
          }
    self.timeline = timeline_logic.updateOrCreateFromFields(
      timeline_properties)

    # Create a program for a_sponsor
    program_properties = {
        'link_id': 'a_program',
        'scope': self.sponsor,
        'scope_path': self.sponsor.key().id_or_name(),
        'name': 'A Program 2010',
        'short_name': 'AP2010',
        'group_label': 'AP',
        'description': 'This is the program for AP2010.',
        'apps_tasks_limit': 42,
        'slots': 42,
        'timeline': self.timeline,
        'status': 'visible',
        }
    self.program = program_logic.updateOrCreateFromFields(program_properties)

    # Create another user for org admin who is also the founder of the org
    email = '*****@*****.**'
    account = users.User(email=email)
    link_id = 'an_org_admin_user'
    name = 'An Org Admin User'
    org_admin_user_properties = {
        'account': account,
        'link_id': link_id,
        'name': name,
        }
    self.org_admin_user = user_logic.updateOrCreateFromFields(
        org_admin_user_properties)

    # create an org for the program
    org_properties = {
        'link_id': 'an_org',
        'scope': self.program,
        'scope_path': self.program.key().id_or_name(),
        'name': 'An Organization',
        'short_name': 'An Org' ,
        'founder': self.org_admin_user,
        'home_page': 'http://anorg.com',
        'email': '*****@*****.**',
        'description': 'An Organization Description',
        'contact_street': 'An Organization Street',
        'contact_city': 'An Organization City',
        'contact_country': 'United Kingdom',
        'contact_postalcode': '0123456 AnO',
        'phone': '1-555-BANANA',
        'status': 'active',
        }
    self.org = org_logic.updateOrCreateFromFields(org_properties)

    # Create an org admin role for a_user
    org_admin_properties = {
        'link_id': 'an_org_admin',
        'scope_path': self.org.key().id_or_name(),
        'scope': self.org,
        'program': self.program,
        'user' : self.org_admin_user,
        'given_name': 'OrgAdmin',
        'surname': 'Administrator',
        'name_on_documents': 'OrgAdmin Administrator',
        'birth_date': datetime.date(1970, 1, 1),
        'email': '*****@*****.**',
        'res_street': 'An Org Admin Street',
        'res_city': 'An Org Admin City',
        'res_state': 'An Org Admin State',
        'res_country': 'France',
        'res_postalcode': '12345',
        'phone': '1-555-BANANA',
        'agreed_to_tos': True,
        }
    # create the org_admin_entity
    self.org_admin = org_admin_logic.updateOrCreateFromFields(
      org_admin_properties)
    self.scope_path = self.org_admin.scope_path
    self.link_id = self.org_admin.link_id
Пример #2
0
    def setUp(self):
        """Set up required for the view tests.
    """

        # Create a user for sponsor
        email = "*****@*****.**"
        account = users.User(email=email)
        link_id = 'a_sponsor_user'
        name = 'A Sponsor User'
        sponsor_user_properties = {
            'account': account,
            'link_id': link_id,
            'name': name,
        }
        self.sponsor_user = user_logic.updateOrCreateFromFields(
            sponsor_user_properties)

        # Create sponsor role for a_sponsor_user
        link_id = 'a_sponsor'
        name = link_id
        phone = '01234567'
        contact_postalcode = 'A postalcode'
        description = 'A description'
        contact_country = 'United States'
        short_name = 'AS'
        contact_city = 'A city'
        home_page = 'http://www.asponsor.com'
        email = '*****@*****.**'
        sponsor_properties = {
            'link_id': link_id,
            'name': name,
            'short_name': short_name,
            'founder': self.sponsor_user,
            'phone': phone,
            'description': description,
            'contact_country': contact_country,
            'contact_city': contact_city,
            'contact_street': 'A Street',
            'contact_postalcode': contact_postalcode,
            'home_page': home_page,
            'email': email,
        }
        self.sponsor = sponsor_logic.updateOrCreateFromFields(
            sponsor_properties)

        # Create a timeline for a program
        timeline_properties = {
            'link_id': 'a_program',
            'scope_path': 'a_sponsor',
            'scope': self.sponsor,
        }
        self.timeline = timeline_logic.updateOrCreateFromFields(
            timeline_properties)

        # Create a program for a_sponsor
        program_properties = {
            'link_id': 'a_program',
            'scope': self.sponsor,
            'scope_path': self.sponsor.key().id_or_name(),
            'name': 'A Program 2010',
            'short_name': 'AP2010',
            'group_label': 'AP',
            'description': 'This is the program for AP2010.',
            'apps_tasks_limit': 42,
            'slots': 42,
            'timeline': self.timeline,
            'status': 'visible',
        }
        self.program = program_logic.updateOrCreateFromFields(
            program_properties)

        # Create another user for org admin who is also the founder of the org
        email = '*****@*****.**'
        account = users.User(email=email)
        link_id = 'an_org_admin_user'
        name = 'An Org Admin User'
        org_admin_user_properties = {
            'account': account,
            'link_id': link_id,
            'name': name,
        }
        self.org_admin_user = user_logic.updateOrCreateFromFields(
            org_admin_user_properties)

        # create an org for the program
        org_properties = {
            'link_id': 'an_org',
            'scope': self.program,
            'scope_path': self.program.key().id_or_name(),
            'name': 'An Organization',
            'short_name': 'An Org',
            'founder': self.org_admin_user,
            'home_page': 'http://anorg.com',
            'email': '*****@*****.**',
            'description': 'An Organization Description',
            'contact_street': 'An Organization Street',
            'contact_city': 'An Organization City',
            'contact_country': 'United Kingdom',
            'contact_postalcode': '0123456 AnO',
            'phone': '1-555-BANANA',
            'status': 'active',
        }
        self.org = org_logic.updateOrCreateFromFields(org_properties)

        # Create an org admin role for a_user
        org_admin_properties = {
            'link_id': 'an_org_admin',
            'scope_path': self.org.key().id_or_name(),
            'scope': self.org,
            'program': self.program,
            'user': self.org_admin_user,
            'given_name': 'OrgAdmin',
            'surname': 'Administrator',
            'name_on_documents': 'OrgAdmin Administrator',
            'birth_date': datetime.date(1970, 1, 1),
            'email': '*****@*****.**',
            'res_street': 'An Org Admin Street',
            'res_city': 'An Org Admin City',
            'res_state': 'An Org Admin State',
            'res_country': 'France',
            'res_postalcode': '12345',
            'phone': '1-555-BANANA',
            'agreed_to_tos': True,
        }
        # create the org_admin_entity
        self.org_admin = org_admin_logic.updateOrCreateFromFields(
            org_admin_properties)
        self.scope_path = self.org_admin.scope_path
        self.link_id = self.org_admin.link_id
Пример #3
0
  def setUp(self):
    """Set up required for the view tests.
    """

    # Create a user for sponsor
    email = "*****@*****.**"
    account = users.User(email=email)
    link_id = 'a_sponsor_user'
    name = 'A Sponsor User'
    sponsor_user_properties = {
        'account': account,
        'link_id': link_id,
        'name': name,
        }
    self.sponsor_user = user_logic.updateOrCreateFromFields(
        sponsor_user_properties)

    # Create sponsor role for a_sponsor_user
    link_id = 'a_sponsor'
    name = link_id
    phone = '01234567'
    contact_postalcode = 'A postalcode'
    description = 'A description'
    contact_country = 'United States'
    short_name = 'AS'
    contact_city = 'A city'
    home_page = 'http://www.asponsor.com'
    email = '*****@*****.**'
    sponsor_properties = {
        'link_id': link_id,
        'name': name,
        'short_name': short_name,
        'founder': self.sponsor_user,
        'phone': phone,
        'description': description,
        'contact_country': contact_country,
        'contact_city': contact_city,
        'contact_street': 'A Street',
        'contact_postalcode': contact_postalcode,
        'home_page': home_page,
        'email': email,
        }
    self.sponsor = sponsor_logic.updateOrCreateFromFields(sponsor_properties)

    # Create a timeline for a program
    timeline_properties = {
        'link_id': 'a_program',
        'scope_path': 'a_sponsor',
        'scope': self.sponsor,
          }
    self.timeline = timeline_logic.updateOrCreateFromFields(
      timeline_properties)

    # Create a program for a_sponsor
    program_properties = {
        'link_id': 'a_program',
        'scope': self.sponsor,
        'scope_path': self.sponsor.key().id_or_name(),
        'name': 'A Program 2010',
        'short_name': 'AP2010',
        'group_label': 'AP',
        'description': 'This is the program for AP2010.',
        'apps_tasks_limit': 42,
        'slots': 42,
        'timeline': self.timeline,
        'status': 'visible',
        }
    self.program = program_logic.updateOrCreateFromFields(program_properties)

    # Create another user for org admin who is also the founder of the org
    email = '*****@*****.**'
    account = users.User(email=email)
    link_id = 'an_oa_user'
    name = 'An Org Admin User'
    oa_user_properties = {
        'account': account,
        'link_id': link_id,
        'name': name,
        'agreed_to_tos': True,
        }
    self.oa_user = user_logic.updateOrCreateFromFields(
        oa_user_properties)

    # create an org for the program
    org_properties = {
        'link_id': 'an_org',
        'scope': self.program,
        'scope_path': self.program.key().id_or_name(),
        'name': 'An Organization',
        'short_name': 'An Org' ,
        'founder': self.oa_user,
        'home_page': 'http://anorg.com',
        'email': '*****@*****.**',
        'description': 'An Organization Description',
        'contact_street': 'An Organization Street',
        'contact_city': 'An Organization City',
        'contact_country': 'United Kingdom',
        'contact_postalcode': '0123456 AnO',
        'phone': '1-555-BANANA',
        'status': 'active',
        }
    self.org = org_logic.updateOrCreateFromFields(org_properties)

    request_properties = {
        'role': 'gsoc_org_admin',
        'user': self.oa_user,
        'group': self.org,
        'message': 'An Invitation Request Message',
        'status': 'group_accepted',
        }
    self.request = request_logic.updateOrCreateFromFields(request_properties)

    # Create another user for second org admin who will be the backup admin
    email = '*****@*****.**'
    account = users.User(email=email)
    link_id = 'another_oa_user'
    name = 'Another Org Admin User'
    oa_user_properties = {
        'account': account,
        'link_id': link_id,
        'name': name,
        'agreed_to_tos': True,
        }
    self.another_oa_user = user_logic.updateOrCreateFromFields(
        oa_user_properties)

    request_properties = {
        'role': 'gsoc_org_admin',
        'user': self.another_oa_user,
        'group': self.org,
        'message': 'An Invitation Request Message',
        'status': 'group_accepted',
        }
    self.another_request = request_logic.updateOrCreateFromFields(
        request_properties)

    # Create a user for third org admin
    email = '*****@*****.**'
    account = users.User(email=email)
    link_id = 'third_oa_user'
    name = 'Third Org Admin User'
    oa_user_properties = {
        'account': account,
        'link_id': link_id,
        'name': name,
        'agreed_to_tos': True,
        }
    self.third_oa_user = user_logic.updateOrCreateFromFields(
        oa_user_properties)

    request_properties = {
        'role': 'gsoc_org_admin',
        'user': self.third_oa_user,
        'group': self.org,
        'message': 'An Invitation Request Message',
        'status': 'group_accepted',
        }
    self.third_request = request_logic.updateOrCreateFromFields(
        request_properties)
Пример #4
0
  def createOrgAdminUserForAnotherOrg(self, with_oa_entity=False):
    """Create another organization, user and invitation for the user
    """

    # Create a user for org admin who is also the founder of the another_org
    email = '*****@*****.**'
    account = users.User(email=email)
    link_id = 'another_org_oa_user'
    name = 'Another Org Org Admin User'
    oa_user_properties = {
        'account': account,
        'link_id': link_id,
        'name': name,
        'agreed_to_tos': True,
        }
    self.another_org_oa_user = user_logic.updateOrCreateFromFields(
        oa_user_properties)

    # create another org for the program
    org_properties = {
        'link_id': 'another_org',
        'scope': self.program,
        'scope_path': self.program.key().id_or_name(),
        'name': 'Another Organization',
        'short_name': 'Another Org' ,
        'founder': self.another_org_oa_user,
        'home_page': 'http://anotherorg.com',
        'email': '*****@*****.**',
        'description': 'Another Organization Description',
        'contact_street': 'Another Organization Street',
        'contact_city': 'Another Organization City',
        'contact_country': 'Sweden',
        'contact_postalcode': '5653276 NG',
        'phone': '61-434-BLUE',
        'status': 'active',
        }
    self.another_org = org_logic.updateOrCreateFromFields(org_properties)

    request_properties = {
        'role': 'gsoc_org_admin',
        'user': self.another_org_oa_user,
        'group': self.another_org,
        'message': 'An Invitation Request Message',
        'status': 'group_accepted',
        }
    self.another_org_request = request_logic.updateOrCreateFromFields(
        request_properties)

    if with_oa_entity:
      # create a second org admin role for the second org admin user
      oa_properties = {
          'link_id': 'another_org_org_admin',
          'scope_path': self.another_org.key().id_or_name(),
          'scope': self.another_org,
          'program': self.program,
          'user' : self.another_org_oa_user,
          'given_name': 'AnotherOrgOrgAdmin',
          'surname': 'AnotherOrgAdministrator',
          'name_on_documents': 'AnotherOrgOrgAdmin Administrator',
          'birth_date': datetime.date(1975, 12, 15),
          'email': '*****@*****.**',
          'res_street': 'Another Org Admin Street',
          'res_city': 'Another Org Admin City',
          'res_state': 'Another Org Admin State',
          'res_country': 'Netherlands',
          'res_postalcode': '572461',
          'phone': '72-534-COLORLESS',
          'agreed_to_tos': True,
          }
      # create the org_admin_entity
      self.another_org_oa = gsoc_oa_logic.updateOrCreateFromFields(
        oa_properties)

      # Create an user for second org admin for another org
      email = '*****@*****.**'
      account = users.User(email=email)
      link_id = 'another_org_another_oa_user'
      name = 'Another Org Admin User'
      oa_user_properties = {
          'account': account,
          'link_id': link_id,
          'name': name,
          'agreed_to_tos': True,
          }
      self.another_org_oa_user = user_logic.updateOrCreateFromFields(
          oa_user_properties)

      request_properties = {
          'role': 'gsoc_org_admin',
          'user': self.another_org_oa_user,
          'group': self.another_org,
          'message': 'An Invitation Request Message',
          'status': 'group_accepted',
          }
      self.another_org_second_request = request_logic.updateOrCreateFromFields(
          request_properties)
Пример #5
0
    def setUp(self):
        """Set up required for the view tests.
    """

        # Create a user for sponsor
        email = "*****@*****.**"
        account = users.User(email=email)
        link_id = 'a_sponsor_user'
        name = 'A Sponsor User'
        sponsor_user_properties = {
            'account': account,
            'link_id': link_id,
            'name': name,
        }
        self.sponsor_user = user_logic.updateOrCreateFromFields(
            sponsor_user_properties)

        # Create sponsor role for a_sponsor_user
        link_id = 'a_sponsor'
        name = link_id
        phone = '01234567'
        contact_postalcode = 'A postalcode'
        description = 'A description'
        contact_country = 'United States'
        short_name = 'AS'
        contact_city = 'A city'
        home_page = 'http://www.asponsor.com'
        email = '*****@*****.**'
        sponsor_properties = {
            'link_id': link_id,
            'name': name,
            'short_name': short_name,
            'founder': self.sponsor_user,
            'phone': phone,
            'description': description,
            'contact_country': contact_country,
            'contact_city': contact_city,
            'contact_street': 'A Street',
            'contact_postalcode': contact_postalcode,
            'home_page': home_page,
            'email': email,
        }
        self.sponsor = sponsor_logic.updateOrCreateFromFields(
            sponsor_properties)

        # Create a timeline for a program
        timeline_properties = {
            'link_id': 'a_program',
            'scope_path': 'a_sponsor',
            'scope': self.sponsor,
        }
        self.timeline = timeline_logic.updateOrCreateFromFields(
            timeline_properties)

        # Create a program for a_sponsor
        program_properties = {
            'link_id': 'a_program',
            'scope': self.sponsor,
            'scope_path': self.sponsor.key().id_or_name(),
            'name': 'A Program 2010',
            'short_name': 'AP2010',
            'group_label': 'AP',
            'description': 'This is the program for AP2010.',
            'apps_tasks_limit': 42,
            'slots': 42,
            'timeline': self.timeline,
            'status': 'visible',
        }
        self.program = program_logic.updateOrCreateFromFields(
            program_properties)

        # Create another user for org admin who is also the founder of the org
        email = '*****@*****.**'
        account = users.User(email=email)
        link_id = 'an_oa_user'
        name = 'An Org Admin User'
        oa_user_properties = {
            'account': account,
            'link_id': link_id,
            'name': name,
            'agreed_to_tos': True,
        }
        self.oa_user = user_logic.updateOrCreateFromFields(oa_user_properties)

        # create an org for the program
        org_properties = {
            'link_id': 'an_org',
            'scope': self.program,
            'scope_path': self.program.key().id_or_name(),
            'name': 'An Organization',
            'short_name': 'An Org',
            'founder': self.oa_user,
            'home_page': 'http://anorg.com',
            'email': '*****@*****.**',
            'description': 'An Organization Description',
            'contact_street': 'An Organization Street',
            'contact_city': 'An Organization City',
            'contact_country': 'United Kingdom',
            'contact_postalcode': '0123456 AnO',
            'phone': '1-555-BANANA',
            'status': 'active',
        }
        self.org = org_logic.updateOrCreateFromFields(org_properties)

        request_properties = {
            'role': 'gsoc_org_admin',
            'user': self.oa_user,
            'group': self.org,
            'message': 'An Invitation Request Message',
            'status': 'group_accepted',
        }
        self.request = request_logic.updateOrCreateFromFields(
            request_properties)

        # Create another user for second org admin who will be the backup admin
        email = '*****@*****.**'
        account = users.User(email=email)
        link_id = 'another_oa_user'
        name = 'Another Org Admin User'
        oa_user_properties = {
            'account': account,
            'link_id': link_id,
            'name': name,
            'agreed_to_tos': True,
        }
        self.another_oa_user = user_logic.updateOrCreateFromFields(
            oa_user_properties)

        request_properties = {
            'role': 'gsoc_org_admin',
            'user': self.another_oa_user,
            'group': self.org,
            'message': 'An Invitation Request Message',
            'status': 'group_accepted',
        }
        self.another_request = request_logic.updateOrCreateFromFields(
            request_properties)

        # Create a user for third org admin
        email = '*****@*****.**'
        account = users.User(email=email)
        link_id = 'third_oa_user'
        name = 'Third Org Admin User'
        oa_user_properties = {
            'account': account,
            'link_id': link_id,
            'name': name,
            'agreed_to_tos': True,
        }
        self.third_oa_user = user_logic.updateOrCreateFromFields(
            oa_user_properties)

        request_properties = {
            'role': 'gsoc_org_admin',
            'user': self.third_oa_user,
            'group': self.org,
            'message': 'An Invitation Request Message',
            'status': 'group_accepted',
        }
        self.third_request = request_logic.updateOrCreateFromFields(
            request_properties)
Пример #6
0
    def createOrgAdminUserForAnotherOrg(self, with_oa_entity=False):
        """Create another organization, user and invitation for the user
    """

        # Create a user for org admin who is also the founder of the another_org
        email = '*****@*****.**'
        account = users.User(email=email)
        link_id = 'another_org_oa_user'
        name = 'Another Org Org Admin User'
        oa_user_properties = {
            'account': account,
            'link_id': link_id,
            'name': name,
            'agreed_to_tos': True,
        }
        self.another_org_oa_user = user_logic.updateOrCreateFromFields(
            oa_user_properties)

        # create another org for the program
        org_properties = {
            'link_id': 'another_org',
            'scope': self.program,
            'scope_path': self.program.key().id_or_name(),
            'name': 'Another Organization',
            'short_name': 'Another Org',
            'founder': self.another_org_oa_user,
            'home_page': 'http://anotherorg.com',
            'email': '*****@*****.**',
            'description': 'Another Organization Description',
            'contact_street': 'Another Organization Street',
            'contact_city': 'Another Organization City',
            'contact_country': 'Sweden',
            'contact_postalcode': '5653276 NG',
            'phone': '61-434-BLUE',
            'status': 'active',
        }
        self.another_org = org_logic.updateOrCreateFromFields(org_properties)

        request_properties = {
            'role': 'gsoc_org_admin',
            'user': self.another_org_oa_user,
            'group': self.another_org,
            'message': 'An Invitation Request Message',
            'status': 'group_accepted',
        }
        self.another_org_request = request_logic.updateOrCreateFromFields(
            request_properties)

        if with_oa_entity:
            # create a second org admin role for the second org admin user
            oa_properties = {
                'link_id': 'another_org_org_admin',
                'scope_path': self.another_org.key().id_or_name(),
                'scope': self.another_org,
                'program': self.program,
                'user': self.another_org_oa_user,
                'given_name': 'AnotherOrgOrgAdmin',
                'surname': 'AnotherOrgAdministrator',
                'name_on_documents': 'AnotherOrgOrgAdmin Administrator',
                'birth_date': datetime.date(1975, 12, 15),
                'email': '*****@*****.**',
                'res_street': 'Another Org Admin Street',
                'res_city': 'Another Org Admin City',
                'res_state': 'Another Org Admin State',
                'res_country': 'Netherlands',
                'res_postalcode': '572461',
                'phone': '72-534-COLORLESS',
                'agreed_to_tos': True,
            }
            # create the org_admin_entity
            self.another_org_oa = gsoc_oa_logic.updateOrCreateFromFields(
                oa_properties)

            # Create an user for second org admin for another org
            email = '*****@*****.**'
            account = users.User(email=email)
            link_id = 'another_org_another_oa_user'
            name = 'Another Org Admin User'
            oa_user_properties = {
                'account': account,
                'link_id': link_id,
                'name': name,
                'agreed_to_tos': True,
            }
            self.another_org_oa_user = user_logic.updateOrCreateFromFields(
                oa_user_properties)

            request_properties = {
                'role': 'gsoc_org_admin',
                'user': self.another_org_oa_user,
                'group': self.another_org,
                'message': 'An Invitation Request Message',
                'status': 'group_accepted',
            }
            self.another_org_second_request = request_logic.updateOrCreateFromFields(
                request_properties)