示例#1
0
    def test_processs_page_displays_all_list_items(self):
        Process.objects.create(name='process 1', description='process 1')
        Process.objects.create(name='process 2', description='process 2')

        request = HttpRequest()
        response = processes_page(request)

        self.assertIn('process 1', response.content.decode())
        self.assertIn('process 2', response.content.decode())
示例#2
0
    def test_process_page_redirects_after_POST(self):
        request = HttpRequest()
        request.method = 'POST'
        request.POST['process_name'] = 'A new process'

        response = processes_page(request)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(response['location'], '/qms/processes/')  # notharcoded
示例#3
0
    def test_processs_page_displays_all_list_items(self):
        Process.objects.create(name='process 1', description='process 1')
        Process.objects.create(name='process 2', description='process 2')

        request = HttpRequest()
        response = processes_page(request)

        self.assertIn('process 1', response.content.decode())
        self.assertIn('process 2', response.content.decode())
示例#4
0
    def test_process_page_can_save_a_POST_request(self):
        request = HttpRequest()
        request.method = 'POST'
        request.POST['process_name'] = 'A new process'

        response = processes_page(request)

        self.assertEqual(Process.objects.count(), 1)
        new_process = Process.objects.first()
        self.assertEqual(new_process.name, 'A new process')
示例#5
0
    def test_process_page_redirects_after_POST(self):
        request = HttpRequest()
        request.method = 'POST'
        request.POST['process_name'] = 'A new process'

        response = processes_page(request)

        self.assertEqual(response.status_code, 302)
        self.assertEqual(response['location'],
                         '/qms/processes/')  # notharcoded
示例#6
0
    def test_process_page_can_save_a_POST_request(self):
        request = HttpRequest()
        request.method = 'POST'
        request.POST['process_name'] = 'A new process'

        response = processes_page(request)

        self.assertEqual(Process.objects.count(), 1)
        new_process = Process.objects.first()
        self.assertEqual(new_process.name, 'A new process')
示例#7
0
 def test_processs_page_only_saves_processs_when_necessary(self):
     request = HttpRequest()
     processes_page(request)
     self.assertEqual(Process.objects.count(), 0)
示例#8
0
 def test_processes_page_returns_correct_html(self):
     request = HttpRequest()
     response = processes_page(request)
     expected_html = render_to_string('processes.html')
     self.assertEqual(response.content.decode(), expected_html)
示例#9
0
 def test_processs_page_only_saves_processs_when_necessary(self):
     request = HttpRequest()
     processes_page(request)
     self.assertEqual(Process.objects.count(), 0)
示例#10
0
 def test_processes_page_returns_correct_html(self):
     request = HttpRequest()
     response = processes_page(request)
     expected_html = render_to_string('processes.html')
     self.assertEqual(response.content.decode(), expected_html)