コード例 #1
0
    def test_lead_task_create(self):
        lead = BaseLead(name='test', status='test1')
        lead.save()

        complete_date = datetime.now() + timedelta(days=3)
        task = LeadTask(lead=lead,
                        text='test task text',
                        type='Call',
                        complete_till=complete_date)
        self.assertEqual(task.lead.name, 'test')
        self.assertEqual(task.lead.id, lead.id)
        self.assertEqual(task.text, 'test task text')
        self.assertEqual(task.complete_till.date(), complete_date.date())

        task.save()
        self.assertEqual(task.lead.name, 'test')
        self.assertEqual(task.lead.id, lead.id)
        self.assertEqual(task.text, 'test task text')
        self.assertEqual(task.complete_till.date(), complete_date.date())

        _task = LeadTask.objects.get(task.id)
        self.assertEqual(_task.lead.name, 'test')
        self.assertEqual(_task.lead.id, lead.id)
        self.assertEqual(_task.text, 'test task text')
        self.assertEqual(_task._element_type, LeadTask._ELEMENT_TYPES['lead'])
        self.assertEqual(_task.complete_till.date(), complete_date.date())
コード例 #2
0
ファイル: test_base.py プロジェクト: Krukov/amocrm_api
    def test_lead_create(self):

        lead = BaseLead(name='test', status='test2', price=10000.00)
        self.assertEqual(lead.name, 'test')
        self.assertEqual(lead.status, 'test2')
        self.assertEqual(lead.price, 10000)
        self.assertIsNone(lead.id)

        lead.save()
        self.assertEqual(lead.name, 'test')
        self.assertEqual(lead.status, 'test2')
        self.assertEqual(lead.price, 10000)
        self.assertEqual(lead.id, 1)
        
        _lead = BaseLead.objects.get(lead.id)
        self.assertEqual(_lead.name, 'test')
        self.assertEqual(_lead.status, 'test2')
        self.assertEqual(_lead.price, 10000)
        self.assertEqual(_lead.id, 1)
コード例 #3
0
ファイル: test_base.py プロジェクト: Krukov/amocrm_api
    def test_lead_note_create(self):
        lead = BaseLead(name='test', status='test1')
        lead.save()

        note = LeadNote(lead=lead, text='test note text', type='DEAL_CREATED')
        self.assertEqual(note.lead.name, 'test')
        self.assertEqual(note.lead.id, lead.id)
        self.assertEqual(note.text, 'test note text')

        note.save()
        self.assertEqual(note.lead.name, 'test')
        self.assertEqual(note.lead.id, lead.id)
        self.assertEqual(note.text, 'test note text')

        _note = LeadNote.objects.get(note.id)
        self.assertEqual(_note.lead.name, 'test')
        self.assertEqual(_note.lead.id, lead.id)
        self.assertEqual(_note.text, 'test note text')
        self.assertEqual(_note._element_type, LeadTask._ELEMENT_TYPES['lead'])
コード例 #4
0
    def test_lead_create(self):

        lead = BaseLead(name='test', status='test2', price=10000.00)
        self.assertEqual(lead.name, 'test')
        self.assertEqual(lead.status, 'test2')
        self.assertEqual(lead.price, 10000)
        self.assertIsNone(lead.id)

        lead.save()
        self.assertEqual(lead.name, 'test')
        self.assertEqual(lead.status, 'test2')
        self.assertEqual(lead.price, 10000)
        self.assertEqual(lead.id, 1)

        _lead = BaseLead.objects.get(lead.id)
        self.assertEqual(_lead.name, 'test')
        self.assertEqual(_lead.status, 'test2')
        self.assertEqual(_lead.price, 10000)
        self.assertEqual(_lead.id, 1)
コード例 #5
0
    def test_lead_note_create(self):
        lead = BaseLead(name='test', status='test1')
        lead.save()

        note = LeadNote(lead=lead, text='test note text', type='DEAL_CREATED')
        self.assertEqual(note.lead.name, 'test')
        self.assertEqual(note.lead.id, lead.id)
        self.assertEqual(note.text, 'test note text')

        note.save()
        self.assertEqual(note.lead.name, 'test')
        self.assertEqual(note.lead.id, lead.id)
        self.assertEqual(note.text, 'test note text')

        _note = LeadNote.objects.get(note.id)
        self.assertEqual(_note.lead.name, 'test')
        self.assertEqual(_note.lead.id, lead.id)
        self.assertEqual(_note.text, 'test note text')
        self.assertEqual(_note._element_type, LeadTask._ELEMENT_TYPES['lead'])
コード例 #6
0
ファイル: test_base.py プロジェクト: Krukov/amocrm_api
    def test_lead_task_create(self):
        lead = BaseLead(name='test', status='test1')
        lead.save()

        complete_date = datetime.now()+timedelta(days=3)
        task = LeadTask(lead=lead, text='test task text', type='Call', complete_till=complete_date)
        self.assertEqual(task.lead.name, 'test')
        self.assertEqual(task.lead.id, lead.id)
        self.assertEqual(task.text, 'test task text')
        self.assertEqual(task.complete_till.date(), complete_date.date())

        task.save()
        self.assertEqual(task.lead.name, 'test')
        self.assertEqual(task.lead.id, lead.id)
        self.assertEqual(task.text, 'test task text')
        self.assertEqual(task.complete_till.date(), complete_date.date())

        _task = LeadTask.objects.get(task.id)
        self.assertEqual(_task.lead.name, 'test')
        self.assertEqual(_task.lead.id, lead.id)
        self.assertEqual(_task.text, 'test task text')
        self.assertEqual(_task._element_type, LeadTask._ELEMENT_TYPES['lead'])
        self.assertEqual(_task.complete_till.date(), complete_date.date())
コード例 #7
0
ファイル: example.py プロジェクト: Krukov/amocrm_api
new_contact = Contact(name='Example2', company='ExampleCorp2', position='QA', phone='0001')
new_contact.site = 'http://example.com'
new_contact.save()

#===================

contact = Contact.objects.get(new_contact.id)
contact_search = Contact.objects.search('Example2')
assert contact.id == contact_search.id
print(contact.phone)
contact.phone = '8-800-00000000'
contact.save()
contact.create_task('New task, yeee', task_type='Звонок',
                 complete_till=datetime.datetime.now()+datetime.timedelta(days=3))
print(contact.notes)
print(contact.tasks)

#===================

from amocrm import BaseLead, LeadTask, amo_settings

amo_settings.set('*****@*****.**', '4b332718c4c5944003af7e6389860ced', 'testcentrobit')

lead = BaseLead(name=u'some name')
lead.save()
task = LeadTask(lead=lead, text='123', type=u'Звонок',
                complete_till=datetime.datetime.now()+datetime.timedelta(days=3))
task.save()
print(task.id)

leads = LeadTask.objects.all(modified_since=datetime.datetime.now()-datetime.timedelta(days=1))
コード例 #8
0
contact_search = Contact.objects.search('Example2')
assert contact.id == contact_search.id
print(contact.phone)
contact.phone = '8-800-00000000'
contact.save()
contact.create_task('New task, yeee',
                    task_type='Звонок',
                    complete_till=datetime.datetime.now() +
                    datetime.timedelta(days=3))
print(contact.notes)
print(contact.tasks)

#===================

from amocrm import BaseLead, LeadTask, amo_settings

amo_settings.set('*****@*****.**', '4b332718c4c5944003af7e6389860ced',
                 'testcentrobit')

lead = BaseLead(name=u'some name')
lead.save()
task = LeadTask(lead=lead,
                text='123',
                type=u'Звонок',
                complete_till=datetime.datetime.now() +
                datetime.timedelta(days=3))
task.save()
print(task.id)

leads = LeadTask.objects.all(modified_since=datetime.datetime.now() -
                             datetime.timedelta(days=1))