Ejemplo n.º 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)
Ejemplo n.º 2
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()
Ejemplo n.º 3
0
 def test_get_users(self):
     self.assertEqual(0, len(self.company1.get_users()))
     founder1 = FounderFactory()
     self.company1.founders.add(founder1)
     self.assertEqual(1, len(self.company1.get_users()))
     users = self.company1.get_users()
     self.assertEqual(founder1.user, users[0])
Ejemplo n.º 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)
Ejemplo n.º 5
0
    def test_index(self):
        """
        To test the listing of the founders.
        """
        """
        Access : We are connected
        """
        self.client.logout()
        self.client.login(username=self.mentor.user.username,
                          password="******")

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

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

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

        result = self.client.get(reverse('founder:index'), follow=False)
        self.assertEqual(result.status_code, 200)
        """
        Context data

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

        # create strange founder
        founderWeird = FounderFactory()
        founderWeird.user.username = u"ïtrema718"
        founderWeird.save()

        # list of founders.
        result = self.client.get(reverse('founder:index'), follow=False)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(nb_founder + 1, len(result.context['filter']))
Ejemplo n.º 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.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)
Ejemplo n.º 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.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")
Ejemplo n.º 8
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])
Ejemplo n.º 9
0
    def test_update(self):
        """
        To test update a founder.
        """

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

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

        result = self.client.get(reverse(
            'founder:update', kwargs={'pk': self.founder.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(
            'founder:update', kwargs={'pk': founderTest.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(
            'founder:update', kwargs={'pk': founderTest.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(
            'founder:update', kwargs={'pk': founderTest.userProfile_id}),
                                 follow=False)
        self.assertEqual(result.status_code, 302)
        """
        No Access : Not logged
        """
        self.client.logout()

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

        result = self.client.get(reverse('founder:update',
                                         kwargs={'pk': 999999}),
                                 follow=False)
        self.assertEqual(result.status_code, 404)
Ejemplo n.º 10
0
    def test_update(self):
        """
        To test update a company.
        """
        """
        Access : Staff only
        """
        self.client.logout()
        self.assertTrue(
            self.client.login(username=self.staff.user.username,
                              password="******"))

        result = self.client.get(reverse('company:update',
                                         kwargs={'pk': self.company.id}),
                                 follow=False)
        self.assertEqual(result.status_code, 200)
        """
        Access : Founder on personnal company
        """
        companyTest = CompanyFactory(companyStatus=self.status)
        founderTest = FounderFactory()
        companyTest.founders.add(founderTest)
        companyTest.save()

        self.client.logout()
        self.client.login(username=founderTest.user.username,
                          password="******")

        result = self.client.get(reverse('company:update',
                                         kwargs={'pk': companyTest.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('company:update',
                                         kwargs={'pk': self.company.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('company:update',
                                         kwargs={'pk': self.company.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('company:update',
                                         kwargs={'pk': self.company.id}),
                                 follow=False)
        self.assertEqual(result.status_code, 302)
        """
        No Access : Not logged
        """
        self.client.logout()

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

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