示例#1
0
            self.assertEqual(obj.type, 'Opportunity')
            self.assertTrue('raw' in obj)

    @utils.allow(services=['salesforce', 'dynamics', 'oracle'])
    def test_read_object(self):
        obj = self.account.crm_opportunities.retrieve(self.obj.id)
        # assert Opportunity properties
        self.assertEqual(obj.id, self.obj.id)
        self.assertEqual(obj.type, 'Opportunity')
        self.assertTrue('raw' in obj)

        self.assertTrue('created' in obj)
        self.assertTrue('modified' in obj)
        self.assertTrue('description' in obj)

    @utils.allow(services=['salesforce', 'dynamics', 'oracle'])
    def test_update_object(self):
        obj = self.obj
        obj.description = 'test opportunity description'
        obj.save()
        self.assertEqual('test opportunity description', obj.description)


def test_cases():
    return [utils.create_test_case(acc,
                                   CRMOpportunity) for acc in utils.accounts]

if __name__ == '__main__':
    suite = utils.create_suite(test_cases())
    unittest.TextTestRunner(verbosity=2).run(suite)
示例#2
0
            obj = objects[0]
            self.assertEqual(obj.type, 'Lead')
            self.assertTrue('raw' in obj)

    @utils.allow(services=['salesforce', 'dynamics', 'oracle'])
    def test_read_object(self):
        obj = self.account.crm_leads.retrieve(self.obj.id)
        # assert Lead properties
        self.assertEqual(obj.id, self.obj.id)
        self.assertEqual(obj.type, 'Lead')
        self.assertTrue('raw' in obj)

        self.assertTrue('created' in obj)
        self.assertTrue('modified' in obj)
        self.assertTrue('description' in obj)

    @utils.allow(services=['salesforce', 'dynamics', 'oracle'])
    def test_update_object(self):
        obj = self.obj
        obj.description = 'test lead description'
        obj.save()
        self.assertEqual('test lead description', obj.description)


def test_cases():
    return [utils.create_test_case(acc, CRMLead) for acc in utils.accounts]

if __name__ == '__main__':
    suite = utils.create_suite(test_cases())
    unittest.TextTestRunner(verbosity=2).run(suite)