Exemplo n.º 1
0
 def setUp(self):
     super().setUp()
     self.stage = d_factories.CareerStageFactory()
     self.gender = d_factories.GenderFactory()
     self.aot = d_factories.AboriginalOrTorresFactory()
     self.state = d_factories.StateFactory()
     self.keyword = KeywordFactory()
     self.reviewer = factories.ReviewerFactory()
Exemplo n.º 2
0
    def test_counts_gender(self):
        profile = self.abstract.submitter.profile

        demographic = factories.GenderFactory()
        profile.gender = demographic
        profile.save()

        data = utilities.compute_statistics()
        self.assertEqual(data['gender'][demographic.text], 1)
Exemplo n.º 3
0
    def test_counts_gender(self):
        request = self.factory.get('/', HTTP_X_REQUESTED_WITH='XMLHttpRequest')
        profile = self.abstract.submitter.profile

        demographic = demographics_factories.GenderFactory()
        profile.gender = demographic
        profile.save()

        response = views.index(request)
        data = json.loads(response.content.decode('utf-8'))
        self.assertEqual(data['gender'][demographic.text], 1)
Exemplo n.º 4
0
    def test_stats_computed_from_passed_abstracts(self):
        demographic1 = factories.GenderFactory(text='Male')
        demographic2 = factories.GenderFactory(text='Female')

        profile = self.abstract.submitter.profile
        profile.gender = demographic1
        profile.save()

        profile = self.abstract_2.submitter.profile
        profile.gender = demographic2
        profile.save()

        data = utilities.compute_statistics()
        self.assertEqual(data['gender'][demographic1.text], 1)
        self.assertEqual(data['gender'][demographic2.text], 1)

        data = utilities.compute_statistics(
            Abstract.objects.filter(id=self.abstract.id))
        self.assertEqual(data['gender'][demographic1.text], 1)
        self.assertEqual(data['gender'][demographic2.text], 0)