예제 #1
0
    def test_to_dict(self):
        tree_data = TreeData(
            nodes=[
                WorkloadTreeNode(
                    type="jobs",
                    name="loadleveler_jobs",
                    blob_ticket_id=1
                ),
                WorkloadTreeNode(
                    type="abnormal_jobs",
                    name="loadleveler_abnormal_jobs",
                    blob_ticket_id=2
                )
            ]
        )

        tree_data_dict = {
            'nodes': [
                {
                    '_cls': 'WorkloadTreeNode',
                    'type': 'jobs',
                    'name': 'loadleveler_jobs',
                    'blob_ticket_id': 1
                },
                {
                    '_cls': 'WorkloadTreeNode',
                    'type': 'abnormal_jobs',
                    'name': 'loadleveler_abnormal_jobs',
                    'blob_ticket_id': 2
                }
            ]
        }

        assert tree_data.to_dict() == tree_data_dict
예제 #2
0
    def test_to_dict(self):
        tree_data = TreeData(nodes=[
            TreeNode(type="status", name="sms_status_tree", blob_ticket_id=1),
            TreeNode(type="aborted_tasks",
                     name="sms_aborted_tasks_tree",
                     blob_ticket_id=2)
        ])

        tree_data_dict = {
            'nodes': [{
                '_cls': 'TreeNode',
                'type': 'status',
                'name': 'sms_status_tree',
                'blob_ticket_id': 1
            }, {
                '_cls': 'TreeNode',
                'type': 'aborted_tasks',
                'name': 'sms_aborted_tasks_tree',
                'blob_ticket_id': 2
            }]
        }

        assert tree_data.to_dict() == tree_data_dict