當前位置: 首頁>>代碼示例>>Python>>正文


Python ContactRecordFactory.create_batch方法代碼示例

本文整理匯總了Python中mypartners.tests.factories.ContactRecordFactory.create_batch方法的典型用法代碼示例。如果您正苦於以下問題:Python ContactRecordFactory.create_batch方法的具體用法?Python ContactRecordFactory.create_batch怎麽用?Python ContactRecordFactory.create_batch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mypartners.tests.factories.ContactRecordFactory的用法示例。


在下文中一共展示了ContactRecordFactory.create_batch方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def setUp(self):
        super(TestDownloads, self).setUp()
        self.client = TestClient(path=reverse('downloads'),
                                 HTTP_X_REQUESTED_WITH='XMLHttpRequest')
        self.client.login_user(self.user)

        ContactRecordFactory.create_batch(10, partner__owner=self.company)
開發者ID:kepinae,項目名稱:MyJobs,代碼行數:9,代碼來源:test_views.py

示例2: test_filtering_on_foreign_key

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def test_filtering_on_foreign_key(self):
        """Test the ability to filter on a model's foreign key fields."""

        PartnerFactory.create_batch(5, name='Test Partner', owner=self.company)

        ContactRecordFactory.create_batch(
            5, partner=self.partner, contact__name='Jane Doe')


        self.client.path += '/partner'
        filters = json.dumps({
            'name': {
                'icontains': 'Test Partner',
            },
            'contactrecord': {
                'contact': {
                    'name': {
                        'icontains': 'Jane Doe'
                    }
                }
            }
        })
        response = self.client.post(data={'filters': filters})
        output = json.loads(response.content)

        self.assertEqual(response.status_code, 200)
        # We look for distinct records
        self.assertEqual(len(output), 1)
開發者ID:kepinae,項目名稱:MyJobs,代碼行數:30,代碼來源:test_views.py

示例3: setUp

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def setUp(self):
        super(ContactRecordFormTests, self).setUp()

        self.contact_record = ContactRecordFactory(
            contact=self.contact, partner=self.partner)

        # The contact record form has a lot of required fields.
        self.data = {
            'contact_type': self.contact_record.contact_type,
            'contact': self.contact_record.contact.pk,
            'contact_email': self.contact_record.contact_email,
            'length_0': "00",
            'length_1': "30",
            'date_time_0': "Aug",
            'date_time_1': "24",
            'date_time_2': "2015",
            'date_time_3': "03",
            'date_time_4': "10",
            'date_time_5': "PM",
            'notes': self.contact_record.notes,
            'partner': self.contact_record.partner.pk,
            'company': self.contact_record.partner.owner
        }
        self.form = ContactRecordForm(
            instance=self.contact_record, partner=self.partner, data=self.data)

        # add a few contact records so that we have some to select from
        ContactRecordFactory.create_batch(3, partner=self.partner,
                                          contact=self.contact,
                                          contact_type='phone')

        self.client.path = reverse(
            "partner_edit_record") + "?partner=%s" % self.partner.pk
開發者ID:kepinae,項目名稱:MyJobs,代碼行數:35,代碼來源:test_forms.py

示例4: setUp

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def setUp(self):
        super(TestHelpers, self).setUp()

        tags = [TagFactory(name=name, company=self.company) for name in ["test", "stuff", "working"]]

        # Returns a list rather than a QuerySet, which is what the helper
        # functions use, so saving this to a variable isn't really helpful
        ContactRecordFactory.create_batch(10, partner=self.partner, contact__name="Joe Shmoe", tags=tags)
        self.records = ContactRecord.objects.all()
開發者ID:abdulfiroz007,項目名稱:MyJobs,代碼行數:11,代碼來源:test_helpers.py

示例5: test_json_output

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def test_json_output(self):
        """Test that filtering contact records through ajax works properly."""

        # records to be filtered out
        ContactRecordFactory.create_batch(10, contact__name="John Doe")

        self.client.path += "/contactrecord"
        response = self.client.get(data={"contact__name": "Joe Shmoe"})
        output = json.loads(response.content)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(output), 10)
開發者ID:vfulco,項目名稱:MyJobs,代碼行數:14,代碼來源:test_views.py

示例6: test_only_user_results_returned

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def test_only_user_results_returned(self):
        """Results should only contain records user has access to."""

        # records not owned by user
        partner = PartnerFactory(name="Wrong Partner")
        ContactRecordFactory.create_batch(10, partner=partner)

        self.client.path += '/contactrecord'
        response = self.client.post()
        output = json.loads(response.content)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(output), 10)
開發者ID:kepinae,項目名稱:MyJobs,代碼行數:15,代碼來源:test_views.py

示例7: test_filtering_on_foreign_key

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def test_filtering_on_foreign_key(self):
        """Test the ability to filter on a model's foreign key fields."""

        PartnerFactory.create_batch(5, name="Test Partner", owner=self.company)

        ContactRecordFactory.create_batch(5, partner=self.partner, contact__name="Jane Doe")

        self.client.path += "/partner"
        filters = json.dumps(
            {"name": {"icontains": "Test Partner"}, "contactrecord": {"contact": {"name": {"icontains": "Jane Doe"}}}}
        )
        response = self.client.post(data={"filters": filters})
        output = json.loads(response.content)

        self.assertEqual(response.status_code, 200)
        # We look for distinct records
        self.assertEqual(len(output), 1)
開發者ID:DirectEmployers,項目名稱:MyJobs,代碼行數:19,代碼來源:test_views.py

示例8: test_json_output

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def test_json_output(self):
        """Test that filtering contact records through ajax works properly."""

        # records to be filtered out
        ContactRecordFactory.create_batch(10, contact__name='John Doe')

        self.client.path += '/contactrecord'
        filters = json.dumps({
            'contact': {
                'name': {
                    'icontains': 'Joe Shmoe'
                }
            }
        })
        response = self.client.post(data={'filters': filters})
        output = json.loads(response.content)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(output), 10)
開發者ID:kepinae,項目名稱:MyJobs,代碼行數:21,代碼來源:test_views.py

示例9: setUp

# 需要導入模塊: from mypartners.tests.factories import ContactRecordFactory [as 別名]
# 或者: from mypartners.tests.factories.ContactRecordFactory import create_batch [as 別名]
    def setUp(self):
        super(TestDownloadReport, self).setUp()
        self.client = TestClient(path=reverse("download_report"))
        self.client.login_user(self.user)

        ContactRecordFactory.create_batch(5, partner__owner=self.company)
        ContactRecordFactory.create_batch(5, contact_type="job", job_applications=1, partner__owner=self.company)
        ContactRecordFactory.create_batch(5, contact_type="job", job_hires=1, partner__owner=self.company)
開發者ID:vfulco,項目名稱:MyJobs,代碼行數:10,代碼來源:test_views.py


注:本文中的mypartners.tests.factories.ContactRecordFactory.create_batch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。