Ejemplo n.º 1
0
    def setUp(self):
        """See unittest.TestCase.setUp for specification."""
        program = program_utils.seedProgram()
        self.org_app = program_utils.seedApplicationSurvey(program.key())
        self.org = org_utils.seedOrganization(program.key())

        self.kwargs = {
            'sponsor': org_model.getSponsorId(self.org.key),
            'program': org_model.getProgramId(self.org.key),
            'organization': org_model.getOrgId(self.org.key)
        }
Ejemplo n.º 2
0
  def setUp(self):
    """See unittest.TestCase.setUp for specification."""
    program = program_utils.seedProgram()
    self.org_app = program_utils.seedApplicationSurvey(program.key())
    self.org = org_utils.seedOrganization(program.key())

    self.kwargs = {
        'sponsor': org_model.getSponsorId(self.org.key),
        'program': org_model.getProgramId(self.org.key),
        'organization': org_model.getOrgId(self.org.key)
        }
Ejemplo n.º 3
0
  def organization(self, org_key, url_name):
    """Returns the URL of an organization's named page.

    Args:
      org_key: Organization key.
      url_name: The name with which a URL was registered with Django.

    Returns:
      The URL of the page matching the given name for the given organization.
    """
    kwargs = {
        'sponsor': org_model.getSponsorId(org_key),
        'program': org_model.getProgramId(org_key),
        'organization': org_model.getOrgId(org_key)
        }
    return urlresolvers.reverse(url_name, kwargs=kwargs)
Ejemplo n.º 4
0
    def organization(self, org_key, url_name):
        """Returns the URL of an organization's named page.

    Args:
      org_key: Organization key.
      url_name: The name with which a URL was registered with Django.

    Returns:
      The URL of the page matching the given name for the given organization.
    """
        kwargs = {
            'sponsor': org_model.getSponsorId(org_key),
            'program': org_model.getProgramId(org_key),
            'organization': org_model.getOrgId(org_key)
        }
        return urlresolvers.reverse(url_name, kwargs=kwargs)
Ejemplo n.º 5
0
  def connect_org(self, org_key=None):
    """Sets the _url_name for a gsoc_org_connection redirect.

    Intended for use when generating a url for a redirect to
    UserConnectionPage.

    Args:
      org_key: Override the current organization (if any) provided
        by the RequestData object. Intended specifically for the call
        from connect_user.
    """
    if not org_key:
      org_key = self._data.url_ndb_org.key

    # We need to reassign the kwarg to the org's link_id since it's
    # being set to the Organization object
    self.kwargs['sponsor'] = melange_org_model.getSponsorId(org_key)
    self.kwargs['program'] = melange_org_model.getProgramId(org_key)
    self.kwargs['organization'] = melange_org_model.getOrgId(org_key)
    self._url_name = url_names.GSOC_USER_CONNECTION
    return self
Ejemplo n.º 6
0
    def connect_org(self, org_key=None):
        """Sets the _url_name for a gsoc_org_connection redirect.

    Intended for use when generating a url for a redirect to
    UserConnectionPage.

    Args:
      org_key: Override the current organization (if any) provided
        by the RequestData object. Intended specifically for the call
        from connect_user.
    """
        if not org_key:
            org_key = self._data.url_ndb_org.key

        # We need to reassign the kwarg to the org's link_id since it's
        # being set to the Organization object
        self.kwargs['sponsor'] = melange_org_model.getSponsorId(org_key)
        self.kwargs['program'] = melange_org_model.getProgramId(org_key)
        self.kwargs['organization'] = melange_org_model.getOrgId(org_key)
        self._url_name = url_names.GSOC_USER_CONNECTION
        return self