Example #1
0
    def setUp(self):
        self.status1 = CompanyStatusFactory()
        self.company1 = CompanyFactory(companyStatus=self.status1)

        self.card1 = CardFactory(company=self.company1,
                                 phase=PHASE_CHOICES[1][1],
                                 state=False)
Example #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()

        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)
Example #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()

        self.status = CompanyStatusFactory()
        self.company = CompanyFactory(companyStatus=self.status)
Example #4
0
    def test_index(self):
        """
        To test the listing of the companies.
        """
        """
        Access

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

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

        nb_company = len(result.context['filter'])
        """
        No Access

        We are not connected
        """
        self.client.logout()

        # list of companies.
        result = self.client.get(reverse('company:index'), follow=False)
        self.assertEqual(result.status_code, 302)
        """
        Context data

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

        # create strange company
        companyWeird = CompanyFactory(companyStatus=self.status)
        companyWeird.name = u"Company ïtrema718"
        companyWeird.save()

        # list of companies.
        result = self.client.get(reverse('company:index'), follow=False)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(nb_company + 1, len(result.context['filter']))
Example #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.card = CardFactory(company=self.company,
                                phase=PHASE_CHOICES[0][1],
                                state=False)
Example #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)
Example #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")
Example #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])
Example #9
0
 def setUp(self):
     self.status1 = CompanyStatusFactory()
     self.company1 = CompanyFactory(companyStatus=self.status1)
Example #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)