Beispiel #1
0
 def init(self):
     """Performs test set-up by seeding data and setting attributes."""
     super(GSoCTestCase, self).init()
     self.sponsor = program_utils.seedSponsor()
     self.program = self.gsoc = program_utils.seedGSoCProgram(sponsor_key=self.sponsor.key())
     self.program_helper = program_utils.GSoCProgramHelper(sponsor=self.sponsor, program=self.program)
     self.site = program_utils.seedSite(active_program=self.program)
     self.org = self.program_helper.createOrg()
     self.org_app = self.program_helper.createOrgApp()
     self.timeline_helper = timeline_utils.GSoCTimelineHelper(self.gsoc.timeline, self.org_app)
 def createGCIProgram(self):
   """Create GCI Program."""
   self.program_helper = program_utils.GCIProgramHelper()
   self.gci = self.program = self.program_helper.createProgram(override={'name':'Google Code In',
     'short_name':'gci'})
   self.program = self.gci.key().name()
   self.org = self.program_helper.createOrg()
   self.org_app = self.program_helper.createOrgApp()
   self.user = profile_utils.seedNDBProfile(self.gci.key())
   self.sponsor = program_utils.seedSponsor(sponsor_id='google')
   self.site = program_utils.seedSite(latest_gci=self.sponsor.key().name() + '/' + self.program, active_program=self.gci)
Beispiel #3
0
 def init(self):
     """Performs test set-up by seeding data and setting attributes."""
     super(GSoCTestCase, self).init()
     self.sponsor = program_utils.seedSponsor()
     self.program = self.gsoc = program_utils.seedGSoCProgram(
         sponsor_key=self.sponsor.key())
     self.program_helper = program_utils.GSoCProgramHelper(
         sponsor=self.sponsor, program=self.program)
     self.site = program_utils.seedSite(active_program=self.program)
     self.org = self.program_helper.createOrg()
     self.org_app = self.program_helper.createOrgApp()
     self.timeline_helper = timeline_utils.GSoCTimelineHelper(
         self.gsoc.timeline, self.org_app)
Beispiel #4
0
  def testOrgMemberWelcomeEmailSent(self):
    """Tests that welcome email is sent if needed."""
    program_messages = program_utils.seedProgramMessages(
        program_key=self.program.key())
    site = program_utils.seedSite()
    profile_logic.assignOrgAdminRoleForOrg(
        self.profile, self.org.key, send_org_member_welcome_email=True,
        program=self.program, program_messages=program_messages, site=site)

    self.assertIn(
        ndb_profile_model.MessageType.ORG_MEMBER_WELCOME_MSG,
        self.profile.sent_messages)
    self.assertEmailSent(to=self.profile.contact.email)
Beispiel #5
0
 def createGSoCProgram(self):
     """Create GSoC Program."""
     self.program_helper = program_utils.GSoCProgramHelper()
     self.gsoc = self.program_helper.createProgram(override={
         'name': 'Google Summer of Code',
         'short_name': 'gsoc'
     })
     self.program = self.gsoc.key().name()
     self.org = self.program_helper.createOrg()
     self.org_app = self.program_helper.createOrgApp()
     self.user = profile_utils.seedNDBProfile(self.gsoc.key())
     self.sponsor = program_utils.seedSponsor(sponsor_id='google')
     self.site = program_utils.seedSite(
         latest_gsoc=self.sponsor.key().name() + '/' + self.program,
         active_program=self.gsoc)
    def setUp(self):
        """See unittest.TestCase.setUp for specification."""
        self.init()

        # TODO(daniel): it should not seed GSoC Program here
        self.program = program_utils.seedGSoCProgram()

        properties = {'parent': self.program}
        seeder_logic.seed(program_model.ProgramMessages, properties=properties)

        self.site = program_utils.seedSite()

        self.org = org_utils.seedOrganization(self.program.key())

        self.profile = profile_utils.seedNDBProfile(self.program.key(),
                                                    admin_for=[self.org.key])
  def setUp(self):
    """See unittest.TestCase.setUp for specification."""
    self.init()

    # TODO(daniel): it should not seed GSoC Program here
    self.program = program_utils.seedGSoCProgram()

    properties = {'parent': self.program}
    seeder_logic.seed(program_model.ProgramMessages, properties=properties)

    self.site = program_utils.seedSite()

    self.org = org_utils.seedOrganization(self.program.key())

    self.profile = profile_utils.seedNDBProfile(
        self.program.key(), admin_for=[self.org.key])
Beispiel #8
0
  def testOrgMemberWelcomeEmailSent(self):
    """Tests that welcome email is sent properly."""
    site = program_utils.seedSite()

    program = program_utils.seedProgram()
    program_messages = program_utils.seedProgramMessages(
        program_key=program.key())

    profile = profile_utils.seedNDBProfile(program.key())

    profile_logic.dispatchOrgMemberWelcomeEmail(
        profile, program, program_messages, site)

    self.assertEmailSent(
        to=profile.contact.email,
        subject=profile_logic._DEF_ORG_MEMBER_WELCOME_MAIL_SUBJECT)
Beispiel #9
0
    def init(self):
        """Performs test setup.

    Sets the following attributes:
      dev_test: True iff DEV_TEST is in environment (in parent)
    """
        self.dev_test = "DEV_TEST" in os.environ

        self.testbed = testbed.Testbed()
        self.testbed.activate()

        self.policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1)
        self.testbed.init_datastore_v3_stub(consistency_policy=self.policy)

        self.testbed.init_blobstore_stub()
        self.testbed.init_mail_stub()
        self.testbed.init_taskqueue_stub(root_path=APP_ROOT_PATH)

        self.site = program_utils.seedSite()
Beispiel #10
0
    def init(self):
        """Performs test setup.

    Sets the following attributes:
      dev_test: True iff DEV_TEST is in environment (in parent)
    """
        self.dev_test = 'DEV_TEST' in os.environ

        self.testbed = testbed.Testbed()
        self.testbed.activate()

        self.policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(
            probability=1)
        self.testbed.init_datastore_v3_stub(consistency_policy=self.policy)

        self.testbed.init_blobstore_stub()
        self.testbed.init_mail_stub()
        self.testbed.init_taskqueue_stub(root_path=APP_ROOT_PATH)

        self.site = program_utils.seedSite()