Example #1
0
    def test_get_lift_status(self):
        git_errors = ['a', 'b']
        p1 = Pallet()
        p1.success = (False, '')

        p2 = Pallet()
        p3 = Pallet()

        report = lift.get_lift_status([p1, p2, p3], 10, git_errors, [])

        self.assertEqual(report['total_pallets'], 3)
        self.assertEqual(report['num_success_pallets'], 2)
        self.assertEqual(report['git_errors'], git_errors)
Example #2
0
    def test_create_report_object(self):
        git_errors = ['a', 'b']
        copy_results = ['c', 'd']
        p1 = Pallet()
        p1.success = (False, '')

        p2 = Pallet()
        p3 = Pallet()

        report = lift.create_report_object([p1, p2, p3], 10, copy_results, git_errors)

        self.assertEqual(report['total_pallets'], 3)
        self.assertEqual(report['num_success_pallets'], 2)
        self.assertEqual(report['git_errors'], git_errors)
        self.assertEqual(report['copy_results'], copy_results)
Example #3
0
    def test_create_report_object(self):
        git_errors = ['a', 'b']
        copy_results = ['c', 'd']
        p1 = Pallet()
        p1.success = (False, '')

        p2 = Pallet()
        p3 = Pallet()

        report = lift.create_report_object([p1, p2, p3], 10, copy_results,
                                           git_errors, '')

        self.assertEqual(report['total_pallets'], 3)
        self.assertEqual(report['num_success_pallets'], 2)
        self.assertEqual(report['git_errors'], git_errors)
        self.assertEqual(report['copy_results'], copy_results)
Example #4
0
    def test_successful_pallet(self):
        pallet = Pallet()
        pallet.add_crates(
            ['fc1', 'fc2', 'fc3'], {
                'source_workspace': 'Z:\\a\\path\\to\\database.sde',
                'destination_workspace': 'Z:\\a\\path\\to\\database.gdb'
            })
        pallet.success = (True, None)
        pallet.name = 'name'
        pallet._crates[0].result = (Crate.CREATED, None)
        pallet._crates[1].result = (Crate.UPDATED, None)
        pallet._crates[2].result = (Crate.NO_CHANGES, None)
        report = pallet.get_report()

        self.assertEqual(report['name'], 'name')
        self.assertEqual(report['success'], True)
        self.assertEqual(len(report['crates']), 2)
        self.assertEqual(report['crates'][0]['result'], Crate.CREATED, None)
        self.assertEqual(report['crates'][0]['name'], 'fc1')
Example #5
0
    def test_failed_pallet(self):
        pallet = Pallet()
        pallet.add_crates(
            ['fc4', 'fc5', 'fc6'], {
                'source_workspace': 'Z:\\a\\path\\to\\database.sde',
                'destination_workspace': 'Z:\\a\\path\\to\\database.gdb'
            })
        pallet.success = (False, 'Failed message')
        pallet._crates[0].result = (Crate.UPDATED, None)
        pallet._crates[1].result = (Crate.INVALID_DATA, 'Invalid data message')
        pallet._crates[2].result = (Crate.UNHANDLED_EXCEPTION, None)

        report = pallet.get_report()

        self.assertEqual(report['success'], False)
        self.assertEqual(report['message'], 'Failed message')
        self.assertEqual(len(report['crates']), 3)
        self.assertEqual(report['crates'][1]['result'], Crate.INVALID_DATA)
        self.assertEqual(report['crates'][1]['crate_message'],
                         'Invalid data message')