Exemplo n.º 1
0
    def test_06_import_export_import(self):
        profiles = Profiles()
        profiles.setConfiguration('tests/files/test_valid.xml')
        profiles.exportXML('/tmp/exportTest.xml')
        old_json = json.loads(profiles.getJSONString())

        profiles.setConfiguration("/tmp/exportTest.xml")
        new_json = json.loads(profiles.getJSONString())

        self.assertEqual(json.dumps(old_json, sort_keys=True),
                         json.dumps(new_json, sort_keys=True))

        os.remove('/tmp/exportTest.xml')
Exemplo n.º 2
0
    def test_07_create_subprofile(self):
        profiles = Profiles()
        profiles.setConfiguration("tests/files/test_valid.xml")

        dummy = {
            "name": "test_changed",
            "path": "/live/test",
            "type": "normal",
            "channels": [{
                "name": "source1",
                "filter": "*",
                "sources": ["ch1"]
            }],
            "subprofiles": []
        }

        profiles.createSubprofile("/live", dummy)
        prf_json = json.loads(profiles.getJSONString())

        self.assertEqual(
            prf_json["live"]['subprofiles']["test_changed"]['name'],
            'test_changed')
Exemplo n.º 3
0
 def test_01_valid_xml(self):
     """Try to parse valid Profiles file"""
     profiles = Profiles('tests/files/test_valid.xml')
     self.assertTrue(profiles.getJSONString() != '[{}]')