コード例 #1
0
ファイル: tests.py プロジェクト: aztrock/newfies-dialer
    def test_contact_view_import(self):
        """Test Function to check import Contact"""
        response = self.client.get('/contact/import/')
        self.assertTrue(response.context['form'],
                        Contact_fileImport(self.user))
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response,
                                'frontend/contact/import_contact.html')

        response = self.client.post('/contact/import/',
                                    data={'phonebook': '1',
                                          'csv_file': csv_file})
        self.assertEqual(response.status_code, 200)

        new_file = open(
            settings.APPLICATION_DIR +
            '/dialer_audio/fixtures/sample_audio_file.mp3', 'r'
        )
        response = self.client.post('/contact/import/',
                                    data={'phonebook_id': '1',
                                          'csv_file': new_file})
        self.assertEqual(response.status_code, 200)

        request = self.factory.get('/contact/import/')
        request.user = self.user
        request.session = {}
        response = contact_import(request)
        self.assertEqual(response.status_code, 200)
コード例 #2
0
ファイル: tests.py プロジェクト: brucexin/newfies-dialer
    def test_contact_view_import(self):
        """Test Function to check import Contact"""
        response = self.client.get('/contact/import/')
        self.assertTrue(response.context['form'],
                        Contact_fileImport(self.user))
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response,
                                'frontend/contact/import_contact.html')

        response = self.client.post('/contact/import/',
                                    data={
                                        'phonebook': '1',
                                        'csv_file': csv_file
                                    })
        self.assertEqual(response.status_code, 200)

        new_file = open(
            settings.APPLICATION_DIR +
            '/dialer_audio/fixtures/sample_audio_file.mp3', 'r')
        response = self.client.post('/contact/import/',
                                    data={
                                        'phonebook_id': '1',
                                        'csv_file': new_file
                                    })
        self.assertEqual(response.status_code, 200)

        request = self.factory.get('/contact/import/')
        request.user = self.user
        request.session = {}
        response = contact_import(request)
        self.assertEqual(response.status_code, 200)
コード例 #3
0
ファイル: tests.py プロジェクト: chengjunjian/newfies-dialer
    def test_contact_view_import(self):
        """Test Function to check import Contact"""
        response = self.client.get('/contact_import/')
        self.assertTrue(response.context['form'], Contact_fileImport(self.user))
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'dialer_contact/contact/import_contact.html')

        request = self.factory.get('/contact_import/')
        request.user = self.user
        request.session = {}
        response = contact_import(request)
        self.assertEqual(response.status_code, 200)
コード例 #4
0
ファイル: tests.py プロジェクト: zoliapjove/newfies-dialer
    def test_contact_view_import(self):
        """Test Function to check import Contact"""
        response = self.client.get('/contact_import/')
        self.assertTrue(response.context['form'],
                        Contact_fileImport(self.user))
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response,
                                'dialer_contact/contact/import_contact.html')

        request = self.factory.get('/contact_import/')
        request.user = self.user
        request.session = {}
        response = contact_import(request)
        self.assertEqual(response.status_code, 200)