Ejemplo n.º 1
0
    def test_answer_view(self):
        """Verify only analyzers can see hb_data view and view shows answers"""
        answer = AnswerFactory(flow_id='rehanrocks')

        jane = AnalyzerProfileFactory().user
        self.client_login_user(jane)

        resp = self.client.get(reverse('hb_data', args=(answer.id,)))
        assert answer.flow_id in resp.content
Ejemplo n.º 2
0
def generate_sampledata(options):
    survey = SurveyFactory(name=u'Sample survey ' + str(uuid4()),
                           description=u'This is a sample survey.',
                           enabled=True)

    # Add some "real data"
    for i in range(10):
        AnswerFactory(person_id=str(uuid4()),
                      survey_id=survey,
                      score=random.randint(1, 5),
                      max_score=5)

    # Add a test data item
    AnswerFactory(person_id=str(uuid4()),
                  survey_id=survey,
                  score=3,
                  max_score=5,
                  is_test=True)

    print 'Done!'
Ejemplo n.º 3
0
    def test_permissions_and_basic_view(self):
        """Verify only analyzers can see hb_data view and view shows answers"""
        answer = AnswerFactory(flow_id='rehanrocks')

        resp = self.client.get(reverse('hb_data'))
        assert resp.status_code == 403

        jane = AnalyzerProfileFactory().user
        self.client_login_user(jane)

        resp = self.client.get(reverse('hb_data'))
        assert resp.status_code == 200
        assert answer.flow_id in resp.content