コード例 #1
0
    def setUp(self):
        settings.EMAIL_BACKEND = \
            'django.core.mail.backends.locmem.EmailBackend'

        self.founder = FounderFactory()
        self.mentor = MentorFactory()
        self.staff = StaffUserProfileFactory()
        self.executive = ExecutiveUserProfileFactory()

        self.founderCompany = FounderFactory()
        self.mentorCompany = MentorFactory()
        self.status = CompanyStatusFactory()
        self.company = CompanyFactory(companyStatus=self.status)
        self.company.founders.add(self.founderCompany)
        self.company.mentors.add(self.mentorCompany)
        self.company.save()

        self.element = BusinessCanvasElementFactory(
            company=self.company, type=BUSINESS_CANVAS_TYPE_CHOICES[0][0])

        self.element2 = BusinessCanvasElementFactory(
            company=self.company, type=BUSINESS_CANVAS_TYPE_CHOICES[1][0])

        self.archive = ArchiveFactory(company=self.company)
        self.archive.elements.add(self.element)
コード例 #2
0
    def test_index(self):
        """
        To test the listing of the mentors.
        """
        """
        Access : We are connected
        """
        self.client.logout()
        self.client.login(username=self.mentor.user.username,
                          password="******")

        # list of mentors.
        result = self.client.get(reverse('mentor:index'), follow=False)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(1, len(result.context['mentorFilter']))

        nb_mentor = len(result.context['mentorFilter'])
        """
        No Access : We are not connected
        """
        self.client.logout()

        # list of mentors.
        result = self.client.get(reverse('mentor:index'), follow=False)
        self.assertEqual(result.status_code, 302)
        """
        Access : Executive
        """
        self.client.logout()
        self.client.login(username=self.executive.user.username,
                          password="******")

        # list of mentors.
        result = self.client.get(reverse('mentor:index'), follow=False)
        self.assertEqual(result.status_code, 200)
        """
        Context data

        Check filter, who contains all mentors.
        """
        self.client.logout()
        self.client.login(username=self.mentor.user.username,
                          password="******")

        # create strange mentor
        mentorWeird = MentorFactory()
        mentorWeird.user.username = u"ïtrema718"
        mentorWeird.save()

        # list of mentors.
        result = self.client.get(reverse('mentor:index'), follow=False)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(nb_mentor + 1, len(result.context['mentorFilter']))
コード例 #3
0
 def setUp(self):
     settings.EMAIL_BACKEND = \
         'django.core.mail.backends.locmem.EmailBackend'
     self.founder = FounderFactory()
     self.mentor = MentorFactory()
     self.staff = StaffUserProfileFactory()
     self.executive = ExecutiveUserProfileFactory()
コード例 #4
0
    def setUp(self):
        settings.EMAIL_BACKEND = \
            'django.core.mail.backends.locmem.EmailBackend'

        self.founder = FounderFactory()
        self.mentor = MentorFactory()
        self.staff = StaffUserProfileFactory()
        self.executive = ExecutiveUserProfileFactory()

        self.founderCompany = FounderFactory()
        self.mentorCompany = MentorFactory()
        self.status = CompanyStatusFactory()
        self.company = CompanyFactory(companyStatus=self.status)
        self.company.founders.add(self.founderCompany)
        self.company.mentors.add(self.mentorCompany)
        self.company.save()

        self.card = CardFactory(company=self.company,
                                phase=PHASE_CHOICES[0][1],
                                state=False)
コード例 #5
0
    def setUp(self):
        settings.EMAIL_BACKEND = \
            'django.core.mail.backends.locmem.EmailBackend'

        self.founder = FounderFactory()
        self.mentor = MentorFactory()
        self.staff = StaffUserProfileFactory()
        self.executive = ExecutiveUserProfileFactory()

        self.founderCompany = FounderFactory()
        self.mentorCompany = MentorFactory()
        self.status = CompanyStatusFactory()
        self.company = CompanyFactory(companyStatus = self.status)
        self.company.founders.add(self.founderCompany)
        self.company.mentors.add(self.mentorCompany)
        self.company.save()

        self.bourse = BourseFactory(company=self.company, dateSoumission=time.strftime("%Y-%m-%d"), sommeSoumission=10000)
        self.subvention = SubventionFactory(company=self.company, dateSoumission=time.strftime("%Y-%m-%d"), sommeSoumission=10000)
        self.investissement = InvestissementFactory(company=self.company, dateSoumission=time.strftime("%Y-%m-%d"), sommeSoumission=10000)
        self.pret = PretFactory(company=self.company, dateSoumission=time.strftime("%Y-%m-%d"), sommeSoumission=10000)
        self.vente = VenteFactory(company=self.company, dateSoumission=time.strftime("%Y-%m-%d"), sommeSoumission=10000)
コード例 #6
0
    def setUp(self):
        settings.EMAIL_BACKEND = \
            'django.core.mail.backends.locmem.EmailBackend'

        self.founder = FounderFactory()
        self.mentor = MentorFactory()
        self.staff = StaffUserProfileFactory()
        self.executive = ExecutiveUserProfileFactory()

        self.founderCompany = FounderFactory()
        self.mentorCompany = MentorFactory()
        self.status = CompanyStatusFactory()
        self.company = CompanyFactory(companyStatus=self.status)
        self.company.founders.add(self.founderCompany)
        self.company.mentors.add(self.mentorCompany)
        self.company.save()

        self.experiment = CustomerExperimentFactory(
            company=self.company,
            hypothesis="Hypothesis of the experiment",
            experiment_description="description of this experiment",
            test_subject_count=10,
            test_subject_description="description of subject test")
コード例 #7
0
    def setUp(self):
        settings.EMAIL_BACKEND = \
            'django.core.mail.backends.locmem.EmailBackend'

        self.founder = FounderFactory()
        self.mentor = MentorFactory()
        self.staff = StaffUserProfileFactory()
        self.executive = ExecutiveUserProfileFactory()

        self.founderCompany = FounderFactory()
        self.mentorCompany = MentorFactory()
        self.status = CompanyStatusFactory()
        self.company = CompanyFactory(companyStatus=self.status)
        self.company.founders.add(self.founderCompany)
        self.company.mentors.add(self.mentorCompany)
        self.company.save()

        self.irl = KPIFactory(company=self.company,
                              level=1,
                              type=KPI_TYPE_CHOICES[0])
        self.trl = KPIFactory(company=self.company,
                              level=1,
                              type=KPI_TYPE_CHOICES[1])
コード例 #8
0
    def test_index(self):
        """
        To test the listing of the mentors.
        """

        """
        Access : We are connected
        """
        self.client.logout()
        self.client.login(
            username=self.mentor.user.username,
            password="******"
        )

        # list of mentors.
        result = self.client.get(
            reverse('mentor:index'),
            follow=False
        )
        self.assertEqual(result.status_code, 200)
        self.assertEqual(1, len(result.context['mentorFilter']))

        nb_mentor = len(result.context['mentorFilter'])

        """
        No Access : We are not connected
        """
        self.client.logout()

        # list of mentors.
        result = self.client.get(
            reverse('mentor:index'),
            follow=False
        )
        self.assertEqual(result.status_code, 302)

        """
        Access : Executive
        """
        self.client.logout()
        self.client.login(
            username=self.executive.user.username,
            password="******"
        )

        # list of mentors.
        result = self.client.get(
            reverse('mentor:index'),
            follow=False
        )
        self.assertEqual(result.status_code, 200)

        """
        Context data

        Check filter, who contains all mentors.
        """
        self.client.logout()
        self.client.login(
            username=self.mentor.user.username,
            password="******"
        )

        # create strange mentor
        mentorWeird = MentorFactory()
        mentorWeird.user.username = u"ïtrema718"
        mentorWeird.save()

        # list of mentors.
        result = self.client.get(
            reverse('mentor:index'),
            follow=False
        )
        self.assertEqual(result.status_code, 200)
        self.assertEqual(nb_mentor+1, len(result.context['mentorFilter']))
コード例 #9
0
    def test_update(self):
        """
        To test update a mentor.
        """

        mentorTest = MentorFactory()
        """
        Access : Staff
        """
        self.client.logout()
        self.assertTrue(
            self.client.login(username=self.staff.user.username,
                              password="******"))

        result = self.client.get(reverse(
            'mentor:update', kwargs={'pk': mentorTest.userProfile_id}),
                                 follow=False)
        self.assertEqual(result.status_code, 200)
        """
        Access : Mentor on personnal account
        """
        #A mentor
        self.client.logout()
        self.client.login(username=self.mentor.user.username,
                          password="******")

        result = self.client.get(reverse(
            'mentor:update', kwargs={'pk': self.mentor.userProfile_id}),
                                 follow=False)
        self.assertEqual(result.status_code, 200)
        """
        No Access : Not in the staff
        """
        #A founder
        self.client.logout()
        self.client.login(username=self.founder.user.username,
                          password="******")

        result = self.client.get(reverse(
            'mentor:update', kwargs={'pk': mentorTest.userProfile_id}),
                                 follow=False)
        self.assertEqual(result.status_code, 302)

        #A mentor
        self.client.logout()
        self.client.login(username=self.mentor.user.username,
                          password="******")

        result = self.client.get(reverse(
            'mentor:update', kwargs={'pk': mentorTest.userProfile_id}),
                                 follow=False)
        self.assertEqual(result.status_code, 302)

        #An executive
        self.client.logout()
        self.client.login(username=self.executive.user.username,
                          password="******")

        result = self.client.get(reverse(
            'mentor:update', kwargs={'pk': mentorTest.userProfile_id}),
                                 follow=False)
        self.assertEqual(result.status_code, 302)
        """
        No Access : Not logged
        """
        self.client.logout()

        result = self.client.get(reverse(
            'mentor:update', kwargs={'pk': mentorTest.userProfile_id}),
                                 follow=False)
        self.assertEqual(result.status_code, 302)
        """
        Access of an inexistant mentor
        """
        self.client.logout()
        self.client.login(username=self.staff.user.username,
                          password="******")

        result = self.client.get(reverse('mentor:update',
                                         kwargs={'pk': 999999}),
                                 follow=False)
        self.assertEqual(result.status_code, 404)