Esempio n. 1
0
    def test_save(self):
        db_json = '[{"title":"Soccer","key":"/Soccer","isFolder":false,"isLazy":false,"tooltip":"/Soccer","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"countries","key":"/Soccer/countries","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Russia","key":"/Soccer/countries/Russia","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"RFPL","key":"/Soccer/countries/Russia/RFPL","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Moscow","key":"/Soccer/countries/Russia/RFPL/Moscow","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Moscow","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"CSKA","key":"/Soccer/countries/Russia/RFPL/Moscow/CSKA","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Moscow/CSKA","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Lokomotiv","key":"/Soccer/countries/Russia/RFPL/Moscow/Lokomotiv","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Moscow/Lokomotiv","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Dinamo","key":"/Soccer/countries/Russia/RFPL/Moscow/Dinamo","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Moscow/Dinamo","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Spartak","key":"/Soccer/countries/Russia/RFPL/Moscow/Spartak","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Moscow/Spartak","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]},{"title":"Saint-Petersburg","key":"/Soccer/countries/Russia/RFPL/Saint-Petersburg","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Saint-Petersburg","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Zenit","key":"/Soccer/countries/Russia/RFPL/Saint-Petersburg/Zenit","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Saint-Petersburg/Zenit","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]},{"title":"Krasnodar","key":"/Soccer/countries/Russia/RFPL/Krasnodar","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Krasnodar","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Kuban","key":"/Soccer/countries/Russia/RFPL/Krasnodar/Kuban","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Krasnodar/Kuban","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Krasnodar","key":"/Soccer/countries/Russia/RFPL/Krasnodar/Krasnodar","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Krasnodar/Krasnodar","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]},{"title":"Tomsk","key":"/Soccer/countries/Russia/RFPL/Tomsk","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Tomsk","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Tom","key":"/Soccer/countries/Russia/RFPL/Tomsk/Tom","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Tomsk/Tom","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]},{"title":"others","key":"/Soccer/countries/Russia/RFPL/others","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/others","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Rubin","key":"/Soccer/countries/Russia/RFPL/others/Rubin","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/others/Rubin","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Ural","key":"/Soccer/countries/Russia/RFPL/others/Ural","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/others/Ural","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Terek","key":"/Soccer/countries/Russia/RFPL/others/Terek","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/others/Terek","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Amkar","key":"/Soccer/countries/Russia/RFPL/others/Amkar","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/others/Amkar","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Krilya","key":"/Soccer/countries/Russia/RFPL/others/Krilya","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/others/Krilya","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]}]}]},{"title":"England","key":"/Soccer/countries/England","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Manchester","key":"/Soccer/countries/England/Manchester","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/Manchester","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"MC","key":"/Soccer/countries/England/Manchester/MC","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/Manchester/MC","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"MU","key":"/Soccer/countries/England/Manchester/MU","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/Manchester/MU","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]},{"title":"London","key":"/Soccer/countries/England/London","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/London","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Is_the_capital_of_Great_Britain","key":"/Soccer/countries/England/London/Is_the_capital_of_Great_Britain","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/London/Is_the_capital_of_Great_Britain","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Arsenal","key":"/Soccer/countries/England/London/Arsenal","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/London/Arsenal","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Chelsea","key":"/Soccer/countries/England/London/Chelsea","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/London/Chelsea","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Totenham","key":"/Soccer/countries/England/London/Totenham","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/London/Totenham","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Fulham","key":"/Soccer/countries/England/London/Fulham","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/London/Fulham","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]},{"title":"Liverpool","key":"/Soccer/countries/England/Liverpool","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/Liverpool","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Liverpool","key":"/Soccer/countries/England/Liverpool/Liverpool","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/England/Liverpool/Liverpool","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]}]}]},{"title":"country","key":"/Soccer/country","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Russia","key":"/Soccer/country/Russia","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/Russia","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"RFPL","key":"/Soccer/country/Russia/RFPL","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/Russia/RFPL","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"others","key":"/Soccer/country/Russia/RFPL/others","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/Russia/RFPL/others","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Krilya","key":"/Soccer/country/Russia/RFPL/others/Krilya","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/Russia/RFPL/others/Krilya","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Amkar","key":"/Soccer/country/Russia/RFPL/others/Amkar","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/Russia/RFPL/others/Amkar","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]}]}]},{"title":"England","key":"/Soccer/country/England","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/England","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Manchester","key":"/Soccer/country/England/Manchester","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/England/Manchester","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"MU","key":"/Soccer/country/England/Manchester/MU","isFolder":false,"isLazy":false,"tooltip":"/Soccer/country/England/Manchester/MU","href":null,"icon":null,"addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]}]}]}]}]'
        cache_json = '[{"title":"Krilya","key":"/soccer/country/Russia/RFPL/others/Krilya","isFolder":false,"isLazy":false,"tooltip":"/soccer/country/Russia/RFPL/others/Krilya","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Amkar","key":"/soccer/country/Russia/RFPL/others/Amkar","isFolder":false,"isLazy":false,"tooltip":"/soccer/country/Russia/RFPL/others/Amkar","href":null,"icon":"../../css/warning-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Soccer","key":"/Soccer","isFolder":false,"isLazy":false,"tooltip":"/Soccer","href":null,"icon":"","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"countries","key":"/Soccer/countries","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries","href":null,"icon":"","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Russia","key":"/Soccer/countries/Russia","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"RFPL","key":"/Soccer/countries/Russia/RFPL","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Tomsk","key":"/Soccer/countries/Russia/RFPL/Tomsk","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Tomsk","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false},{"title":"Moscow","key":"/Soccer/countries/Russia/RFPL/Moscow","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Moscow","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Spartak","key":"/Soccer/countries/Russia/RFPL/Moscow/Spartak","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Moscow/Spartak","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]},{"title":"Saint-Petersburg","key":"/Soccer/countries/Russia/RFPL/Saint-Petersburg","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Saint-Petersburg","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"Zenit","key":"/Soccer/countries/Russia/RFPL/Saint-Petersburg/Zenit","isFolder":false,"isLazy":false,"tooltip":"/Soccer/countries/Russia/RFPL/Saint-Petersburg/Zenit","href":null,"icon":"../../css/delete-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]}]}]}]}]},{"title":"MU","key":"/soccer/country/England/Manchester/MU","isFolder":false,"isLazy":false,"tooltip":"/soccer/country/England/Manchester/MU","href":null,"icon":"../../css/warning-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false,"children":[{"title":"12","key":"/soccer/country/England/Manchester/MU/12","isFolder":false,"isLazy":false,"tooltip":"/soccer/country/England/Manchester/MU/12","href":null,"icon":"../../css/add-icon.png","addClass":null,"noLink":false,"activate":false,"focus":false,"expand":true,"select":false,"hideCheckbox":false,"unselectable":false}]}]'
        db_tree = DBTree("", db_json)
        cache_tree = CacheTree(cache_json)

        cache_tree.save(db_tree)
        print("Cache Tree changes has been saved.")
        tree_json = db_tree.get_json()
        self.assertEqual('[{"title": "Soccer", "tooltip": "/Soccer", "key": "/Soccer", "expand": true, "icon": null, "children": [{"title": "countries", "tooltip": "/Soccer/countries", "key": "/Soccer/countries", "expand": true, "icon": null, "children": [{"title": "Russia", "tooltip": "/Soccer/countries/Russia", "key": "/Soccer/countries/Russia", "expand": true, "icon": "../../css/delete-icon.png", "children": [{"title": "RFPL", "tooltip": "/Soccer/countries/Russia/RFPL", "key": "/Soccer/countries/Russia/RFPL", "expand": true, "icon": "../../css/delete-icon.png", "children": [{"title": "Moscow", "tooltip": "/Soccer/countries/Russia/RFPL/Moscow", "key": "/Soccer/countries/Russia/RFPL/Moscow", "expand": true, "icon": "../../css/delete-icon.png", "children": [{"title": "CSKA", "tooltip": "/Soccer/countries/Russia/RFPL/Moscow/CSKA", "key": "/Soccer/countries/Russia/RFPL/Moscow/CSKA", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Lokomotiv", "tooltip": "/Soccer/countries/Russia/RFPL/Moscow/Lokomotiv", "key": "/Soccer/countries/Russia/RFPL/Moscow/Lokomotiv", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Dinamo", "tooltip": "/Soccer/countries/Russia/RFPL/Moscow/Dinamo", "key": "/Soccer/countries/Russia/RFPL/Moscow/Dinamo", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Spartak", "tooltip": "/Soccer/countries/Russia/RFPL/Moscow/Spartak", "key": "/Soccer/countries/Russia/RFPL/Moscow/Spartak", "expand": true, "icon": "../../css/delete-icon.png", "children": []}]}, {"title": "Saint-Petersburg", "tooltip": "/Soccer/countries/Russia/RFPL/Saint-Petersburg", "key": "/Soccer/countries/Russia/RFPL/Saint-Petersburg", "expand": true, "icon": "../../css/delete-icon.png", "children": [{"title": "Zenit", "tooltip": "/Soccer/countries/Russia/RFPL/Saint-Petersburg/Zenit", "key": "/Soccer/countries/Russia/RFPL/Saint-Petersburg/Zenit", "expand": true, "icon": "../../css/delete-icon.png", "children": []}]}, {"title": "Krasnodar", "tooltip": "/Soccer/countries/Russia/RFPL/Krasnodar", "key": "/Soccer/countries/Russia/RFPL/Krasnodar", "expand": true, "icon": "../../css/delete-icon.png", "children": [{"title": "Kuban", "tooltip": "/Soccer/countries/Russia/RFPL/Krasnodar/Kuban", "key": "/Soccer/countries/Russia/RFPL/Krasnodar/Kuban", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Krasnodar", "tooltip": "/Soccer/countries/Russia/RFPL/Krasnodar/Krasnodar", "key": "/Soccer/countries/Russia/RFPL/Krasnodar/Krasnodar", "expand": true, "icon": "../../css/delete-icon.png", "children": []}]}, {"title": "Tomsk", "tooltip": "/Soccer/countries/Russia/RFPL/Tomsk", "key": "/Soccer/countries/Russia/RFPL/Tomsk", "expand": true, "icon": "../../css/delete-icon.png", "children": [{"title": "Tom", "tooltip": "/Soccer/countries/Russia/RFPL/Tomsk/Tom", "key": "/Soccer/countries/Russia/RFPL/Tomsk/Tom", "expand": true, "icon": "../../css/delete-icon.png", "children": []}]}, {"title": "others", "tooltip": "/Soccer/countries/Russia/RFPL/others", "key": "/Soccer/countries/Russia/RFPL/others", "expand": true, "icon": "../../css/delete-icon.png", "children": [{"title": "Rubin", "tooltip": "/Soccer/countries/Russia/RFPL/others/Rubin", "key": "/Soccer/countries/Russia/RFPL/others/Rubin", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Ural", "tooltip": "/Soccer/countries/Russia/RFPL/others/Ural", "key": "/Soccer/countries/Russia/RFPL/others/Ural", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Terek", "tooltip": "/Soccer/countries/Russia/RFPL/others/Terek", "key": "/Soccer/countries/Russia/RFPL/others/Terek", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Amkar", "tooltip": "/Soccer/countries/Russia/RFPL/others/Amkar", "key": "/Soccer/countries/Russia/RFPL/others/Amkar", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Krilya", "tooltip": "/Soccer/countries/Russia/RFPL/others/Krilya", "key": "/Soccer/countries/Russia/RFPL/others/Krilya", "expand": true, "icon": "../../css/delete-icon.png", "children": []}]}]}]}, {"title": "England", "tooltip": "/Soccer/countries/England", "key": "/Soccer/countries/England", "expand": true, "icon": null, "children": [{"title": "Manchester", "tooltip": "/Soccer/countries/England/Manchester", "key": "/Soccer/countries/England/Manchester", "expand": true, "icon": null, "children": [{"title": "MC", "tooltip": "/Soccer/countries/England/Manchester/MC", "key": "/Soccer/countries/England/Manchester/MC", "expand": true, "icon": null, "children": []}, {"title": "MU", "tooltip": "/Soccer/countries/England/Manchester/MU", "key": "/Soccer/countries/England/Manchester/MU", "expand": true, "icon": null, "children": []}]}, {"title": "London", "tooltip": "/Soccer/countries/England/London", "key": "/Soccer/countries/England/London", "expand": true, "icon": null, "children": [{"title": "Is_the_capital_of_Great_Britain", "tooltip": "/Soccer/countries/England/London/Is_the_capital_of_Great_Britain", "key": "/Soccer/countries/England/London/Is_the_capital_of_Great_Britain", "expand": true, "icon": null, "children": []}, {"title": "Arsenal", "tooltip": "/Soccer/countries/England/London/Arsenal", "key": "/Soccer/countries/England/London/Arsenal", "expand": true, "icon": null, "children": []}, {"title": "Chelsea", "tooltip": "/Soccer/countries/England/London/Chelsea", "key": "/Soccer/countries/England/London/Chelsea", "expand": true, "icon": null, "children": []}, {"title": "Totenham", "tooltip": "/Soccer/countries/England/London/Totenham", "key": "/Soccer/countries/England/London/Totenham", "expand": true, "icon": null, "children": []}, {"title": "Fulham", "tooltip": "/Soccer/countries/England/London/Fulham", "key": "/Soccer/countries/England/London/Fulham", "expand": true, "icon": null, "children": []}]}, {"title": "Liverpool", "tooltip": "/Soccer/countries/England/Liverpool", "key": "/Soccer/countries/England/Liverpool", "expand": true, "icon": null, "children": [{"title": "Liverpool", "tooltip": "/Soccer/countries/England/Liverpool/Liverpool", "key": "/Soccer/countries/England/Liverpool/Liverpool", "expand": true, "icon": null, "children": []}]}]}]}, {"title": "country", "tooltip": "/Soccer/country", "key": "/Soccer/country", "expand": true, "icon": null, "children": [{"title": "Russia", "tooltip": "/Soccer/country/Russia", "key": "/Soccer/country/Russia", "expand": true, "icon": null, "children": [{"title": "RFPL", "tooltip": "/Soccer/country/Russia/RFPL", "key": "/Soccer/country/Russia/RFPL", "expand": true, "icon": null, "children": [{"title": "others", "tooltip": "/Soccer/country/Russia/RFPL/others", "key": "/Soccer/country/Russia/RFPL/others", "expand": true, "icon": null, "children": [{"title": "Krilya", "tooltip": "/Soccer/country/Russia/RFPL/others/Krilya", "key": "/Soccer/country/Russia/RFPL/others/Krilya", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Amkar", "tooltip": "/Soccer/country/Russia/RFPL/others/Amkar", "key": "/Soccer/country/Russia/RFPL/others/Amkar", "expand": true, "icon": null, "children": []}]}]}]}, {"title": "England", "tooltip": "/Soccer/country/England", "key": "/Soccer/country/England", "expand": true, "icon": null, "children": [{"title": "Manchester", "tooltip": "/Soccer/country/England/Manchester", "key": "/Soccer/country/England/Manchester", "expand": true, "icon": null, "children": [{"title": "MU", "tooltip": "/Soccer/country/England/Manchester/MU", "key": "/Soccer/country/England/Manchester/MU", "expand": true, "icon": null, "children": []}]}]}]}]}, {"title": "soccer", "tooltip": "/soccer", "key": "/soccer", "expand": true, "children": [{"title": "country", "tooltip": "/soccer/country", "key": "/soccer/country", "expand": true, "children": [{"title": "Russia", "tooltip": "/soccer/country/Russia", "key": "/soccer/country/Russia", "expand": true, "children": [{"title": "RFPL", "tooltip": "/soccer/country/Russia/RFPL", "key": "/soccer/country/Russia/RFPL", "expand": true, "children": [{"title": "others", "tooltip": "/soccer/country/Russia/RFPL/others", "key": "/soccer/country/Russia/RFPL/others", "expand": true, "children": [{"title": "Krilya", "tooltip": "/soccer/country/Russia/RFPL/others/Krilya", "key": "/soccer/country/Russia/RFPL/others/Krilya", "expand": true, "icon": "../../css/delete-icon.png", "children": []}, {"title": "Amkar", "tooltip": "/soccer/country/Russia/RFPL/others/Amkar", "key": "/soccer/country/Russia/RFPL/others/Amkar", "expand": true, "children": []}]}]}]}, {"title": "England", "tooltip": "/soccer/country/England", "key": "/soccer/country/England", "expand": true, "children": [{"title": "Manchester", "tooltip": "/soccer/country/England/Manchester", "key": "/soccer/country/England/Manchester", "expand": true, "children": [{"title": "MU", "tooltip": "/soccer/country/England/Manchester/MU", "key": "/soccer/country/England/Manchester/MU", "expand": true, "children": [{"title": "12", "tooltip": "/soccer/country/England/Manchester/MU/12", "key": "/soccer/country/England/Manchester/MU/12", "expand": true, "children": []}]}]}]}]}]}]', tree_json)
Esempio n. 2
0
def get_db_content(request):
    """
        Function which simply queries the DB Tree content.
        If POST data parameter is blank then it build default DB.
        Otherwise function builds DB Tree from JSON.

        :returns the DB Tree content in JSON format.
    """
    #data = get_str_param(request, 'data')
    #logger.info("Request received:\n data: {}".format(data))

    #if data == "":
    tree = DBTree("cfg/db_content.xml")
    #else:
    #   tree = DBTree("", data)
    tree_json = tree.get_json()
    return send_json(tree_json)
Esempio n. 3
0
def save_cache_changes(request):
    """
        Function simulates the save Cache Tree changes into DB Tree.
        INPUT POST parameters:
        1) [mandatory] cache_data -- current content of Cache Tree in JSON format;
        2) [mandatory] db_data -- current content of DB Tree in JSON format.

        :returns updated DB Tree in JSON format.
    """
    cache_data = get_str_param(request, 'cache_data')
    db_data = get_str_param(request, 'db_data')
    logger.debug("Save request received:\n Current DB data={};\nCurrent Cache data: {} ".format(db_data, cache_data))

    db_tree = DBTree("", db_data)
    cache_tree = CacheTree(cache_data)
    cache_tree.save_by_key(db_tree)
    logger.info("Cache Tree changes has been saved.")
    tree_json = db_tree.get_json()
    logger.debug("Response JSON has been built: {}".format(tree_json))
    return send_json(tree_json)