def test_generate_git_repos_json(self):
     create_db_from_file.create_db_file("inputs/create_0.6.3.txt")
     version = "0.6.3"
     distrib = self.ariane.distribution_service.get_unique({"version": version})
     fjson = self.ariane.get_one_file(distrib, "json_git_repos")
     self.g.generate_json_git_repos(version, fjson)
     self.assertTrue(
         (self.g.compare_files("json", self.dir_output + fjson.path + fjson.name, "models/" + fjson.name))
     )
    def test_generate_plugins_json(self):
        create_db_from_file.create_db_file("inputs/create_0.5.3.txt")
        create_db_from_file.create_db_file("inputs/create_0.6.0.txt")
        create_db_from_file.create_db_file("inputs/create_0.6.1.txt")
        create_db_from_file.create_db_file("inputs/create_0.6.2.txt")
        create_db_from_file.create_db_file("inputs/create_0.6.3.txt")
        self.ariane.import_db_from_file("inputs/create_0.6.4-SNAPSHOT.cypher")

        distrib = self.ariane.distribution_service.get_unique({"version": "0.6.4-SNAPSHOT"})
        fjson = self.ariane.get_one_file(distrib, "json_plugins")
        filename = self.g.generate_json_plugins(fjson)
        self.assertTrue(self.g.compare_files("c_json", filename, "models/ariane.community.plugins.json"))
    def test_update_dev_version(self):
        create_db_file(os.path.join(relmgr_path, 'tests/inputs/create_0.6.4-SNAPSHOT.txt'))
        m = modelAndServices.DeliveryTree.component_service.get_unique({"name": "portal", "version": "0.6.4-SNAPSHOT"})
        m2 = modelAndServices.DeliveryTree.component_service.get_unique({"name": "portal", "version": "0.6.3"})
        m.name = "ogal"
        m2.name = "ddodal"
        r = requests.post('http://localhost:5000/rest/component', params={"component": m.to_json()})
        r2 = requests.post('http://localhost:5000/rest/component', params={"component": m2.to_json()})
        mr = m.from_json(r.json())
        print(r.status_code, r.reason, r.json())
        print(r2.status_code, r2.reason, r2.json())
        print(mr)
        self.assertEqual(r.status_code, 200)
        self.assertEqual(r2.status_code, 400)

        m = modelAndServices.DeliveryTree.plugin_service.get_unique({"name": "rabbitmq", "version": "0.2.4-SNAPSHOT"})
        m2 = modelAndServices.DeliveryTree.plugin_service.get_unique({"name": "rabbitmq", "version": "0.2.3"})
        m.name = "ogal"
        m2.name = "ddodal"
        r = requests.post('http://localhost:5000/rest/plugin', params={"plugin": m.to_json()})
        r2 = requests.post('http://localhost:5000/rest/plugin', params={"plugin": m2.to_json()})
        mr = m.from_json(r.json())
        print(r.status_code, r.reason, r.json())
        print(r2.status_code, r2.reason, r2.json())
        print(mr)
        self.assertEqual(r.status_code, 200)
        self.assertEqual(r2.status_code, 400)

        m = modelAndServices.DeliveryTree.module_service.get_unique({"name": "wab", "version": "0.6.4-SNAPSHOT"})
        m2 = modelAndServices.DeliveryTree.module_service.get_unique({"name": "wab", "version": "0.6.3"})
        m.name = "ogal"
        m2.name = "ddodal"
        r = requests.post('http://localhost:5000/rest/module', params={"module": m.to_json()})
        r2 = requests.post('http://localhost:5000/rest/module', params={"module": m2.to_json()})
        mr = m.from_json(r.json())
        print(r.status_code, r.reason, r.json())
        print(r2.status_code, r2.reason, r2.json())
        print(mr)
        self.assertEqual(r.status_code, 200)
        self.assertEqual(r2.status_code, 400)

        mod = modelAndServices.DeliveryTree.component_service.get_unique({"name": "injector", "version": "0.6.4-SNAPSHOT"})
        m = modelAndServices.DeliveryTree.get_one_file(mod, 'pom')
        mod = modelAndServices.DeliveryTree.component_service.get_unique({"name": "injector", "version": "0.6.3"})
        m2 = modelAndServices.DeliveryTree.get_one_file(mod, 'pom')
        m.name = "ogal"
        m2.name = "ddodal"
        r = requests.post('http://localhost:5000/rest/filenode', params={"filenode": json.dumps(m.get_properties())})
        r2 = requests.post('http://localhost:5000/rest/filenode', params={"filenode": json.dumps(m2.get_properties())})
        print(r.status_code, r.reason, r.json())
        print(r2.status_code, r2.reason, r2.json())
        self.assertEqual(r.status_code, 200)
        self.assertEqual(r2.status_code, 400)
 def setUp(self):
     config_path = "/etc/ariane_relmgr/confsrv.json"
     RELMGR_CONFIG = Config()
     RELMGR_CONFIG.parse(config_path)
     # Init variables:
     ariane = modelAndServices.DeliveryTree({"login": RELMGR_CONFIG.neo4j_login,
                                                 "password": RELMGR_CONFIG.neo4j_password,
                                                 "host": RELMGR_CONFIG.neo4j_host,
                                                 "port": RELMGR_CONFIG.neo4j_port,
                                                 "type": "neo4j"})
     modelAndServices.DeliveryTree.graph_dao.delete_all()
     # create_db_file('/Users/stanrenia/py_neo4j_db/tests/inputs/create_0.6.4-SNAPSHOT.txt')
     create_db_file(os.path.join(relmgr_path, "tests/inputs/create_0.6.3.txt"))
 def test_mk_dir(self):
     mkdir = MakeDir()
     mkdir.ariane.delete_all()
     create_db_from_file.create_db_file('inputs/create_0.6.2.txt')
     mkdir.make()
     mkdir.make_distrib_directory()