Exemple #1
0
    def test_Detail_get_questions(self):
        d = Detail()

        r = Representative.objects.get(pk=3)
        questions = {
            'answered': {
                'absolute': 0,
                'relative': 50
            },
            'noresponse': {
                'absolute': 0,
                'relative': 50
            },
            'last': []
        }
        self.assertEqual(d._get_questions(r), questions)

        r = Representative.objects.get(pk=1)
        q = Question.objects.get(pk=2)
        questions = {
            'answered': {
                'absolute': 1,
                'relative': 50.0
            },
            'noresponse': {
                'absolute': 1,
                'relative': 50.0
            },
            'last': q
        }
        self.assertEqual(d._get_questions(r), questions)
Exemple #2
0
    def test_Detail_get_questions (self):
        d = Detail()

        r = Representative.objects.get(pk=3)
        questions = {
            'answered': {'absolute': 0, 'relative': 50},
            'noresponse': {'absolute': 0, 'relative': 50},
            'last': []
        }
        self.assertEqual(d._get_questions(r), questions)

        r = Representative.objects.get(pk=1)
        q = Question.objects.get(pk=2)
        questions = {
            'answered': {'absolute': 1, 'relative': 50.0},
            'noresponse': {'absolute': 1, 'relative': 50.0},
            'last': q
        }
        self.assertEqual(d._get_questions(r), questions)