Example #1
0
 def test_survey_section_view_delete(self):
     """Test Function survey section delete"""
     request = self.factory.post('/section/1/?delete=true', {}, follow=True)
     request.user = self.user
     request.session = {}
     response = section_change(request, 1)
     self.assertEqual(response.status_code, 200)
Example #2
0
 def test_survey_section_view_delete(self):
     """Test Function survey section delete"""
     request = self.factory.post('/section/1/?delete=true',
         {}, follow=True)
     request.user = self.user
     request.session = {}
     response = section_change(request, 1)
     self.assertEqual(response.status_code, 200)
Example #3
0
    def test_survey_section_view_update(self):
        """Test Function survey section update"""
        #self.survey = Survey.objects.get(pk=1)
        request = self.factory.get('/section/1/')
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 1, 'question': 'xyz', 'update': 'true'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 1, 'question': 'xyz'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 2, 'question': 'xyz', 'update': 'true',
             'key_0': 'apple'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 2, 'question': 'xyz',
             'key_0': 'apple'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 3, 'question': 'xyz', 'update': 'true',
             'rating_laps': 5}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 3, 'question': 'xyz',
             'rating_laps': 5}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 4, 'question': 'xyz', 'update': 'true',
             'number_digits': 2,
             'min_number': 1}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 4, 'question': 'xyz',
             'number_digits': 2,
             'min_number': 1}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 5, 'question': 'xyz', 'update': 'true'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 5, 'question': 'xyz'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 6, 'question': 'xyz', 'update': 'true'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 6, 'question': 'xyz'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 10, 'question': 'test question',
             'update': 'true', 'sms_text': 'this is test sms'}, follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)

        request = self.factory.post('/section/1/',
            {'type': 10, 'question': 'xyz', 'sms_text': 'this is test sms'},
            follow=True)
        request.user = self.user
        request.session = {}
        response = section_change(request, 1)
        self.assertEqual(response.status_code, 200)