def test_extension_loads_with_melange_xmlns(self):
        options = {'config_file': tests.test_config_file()}
        conf, app = config.Config.load_paste_app('melangeapi',
                                          options, None)
        test_app = webtest.TestApp(app)

        response = test_app.get("/extensions.xml")
        root = etree.XML(response.body)
        self.assertEqual(root.tag.split('extensions')[0],
                         "{http://docs.openstack.org/melange}")
Exemple #2
0
    def test_extension_loads_with_melange_xmlns(self):
        options = {'config_file': tests.test_config_file()}
        conf, app = config.Config.load_paste_app('melangeapi_v0_1', options,
                                                 None)
        test_app = webtest.TestApp(app)

        response = test_app.get("/extensions.xml")
        root = etree.XML(response.body)
        self.assertEqual(
            root.tag.split('extensions')[0],
            "{http://docs.openstack.org/melange}")
Exemple #3
0
    def test_deallocated_ips_get_deleted(self):
        block = factory_models.PublicIpBlockFactory()
        ip = factory_models.IpAddressFactory(ip_block_id=block.id)
        block.deallocate_ip(ip.address)

        days = config.Config.get('keep_deallocated_ips_for_days')
        self._push_back_deallocated_date(ip, days)

        script = tests.melange_bin_path('melange-delete-deallocated-ips')
        config_file = tests.test_config_file()
        functional.execute("{0} --config-file={1}".format(script, config_file))

        self.assertIsNone(models.IpAddress.get(ip.id))
Exemple #4
0
    def test_deallocated_ips_get_deleted(self):
        block = factory_models.PublicIpBlockFactory()
        ip = factory_models.IpAddressFactory(ip_block_id=block.id)
        block.deallocate_ip(ip.address)

        seconds = config.Config.get('keep_deallocated_ips_for_seconds')
        self._push_back_deallocated_date(ip, seconds)

        script = tests.melange_bin_path('melange-delete-deallocated-ips')
        config_file = tests.test_config_file()
        functional.execute("{0} --config-file={1}".format(script, config_file))

        self.assertIsNone(models.IpAddress.get(ip.id))
Exemple #5
0
    def test_deallocated_ips_get_freed(self):
        block = factory_models.PublicIpBlockFactory()
        ip = factory_models.IpAddressFactory(ip_block_id=block.id)
        block.deallocate_ip(ip.address)

        seconds = config.Config.get('keep_deallocated_ips_for_seconds')
        self._push_back_deallocated_date(ip, seconds)

        script = tests.melange_bin_path('melange-delete-deallocated-ips')
        config_file = tests.test_config_file()
        functional.execute("{0} --config-file={1}".format(script, config_file))

        # NOTE(jkoelker) Dirty, but works. Reset the session_maker so a
        #                new session is started in the current thread
        session._MAKER = None

        ip = models.IpAddress.get(ip.id)
        self.assertFalse(ip.allocated)
        self.assertIsNone(ip.interface)
        self.assertIsNone(ip.used_by_tenant_id)
Exemple #6
0
 def setUp(self):
     conf, melange_app = config.Config.load_paste_app(
         'melange', {"config_file": tests.test_config_file()}, None)
     self.test_app = webtest.TestApp(melange_app)
     super(TestVersionsController, self).setUp()
Exemple #7
0
def run_melange_manage(command):
    melange_manage = tests.melange_bin_path('melange-manage')
    config_file = tests.test_config_file()
    return functional.execute("%(melange_manage)s %(command)s "
                              "--config-file=%(config_file)s" % locals())
Exemple #8
0
def setup():
    options = {"config_file": tests.test_config_file()}
    conf = config.Config.load_paste_config("melange", options, None)

    db_api.db_reset(conf, db_based_mac_generator)
Exemple #9
0
def run_melange_manage(command):
    cmd = dict(melange_manage=tests.melange_bin_path('melange-manage'),
               config_file=tests.test_config_file(),
               command=command)
    return functional.execute("%(melange_manage)s %(command)s "
                              "--config-file=%(config_file)s" % cmd)
 def setUp(self):
     conf, melange_app = config.Config.load_paste_app('melange',
                           {"config_file": tests.test_config_file()}, None)
     self.test_app = webtest.TestApp(melange_app)
     super(TestVersionsController, self).setUp()
Exemple #11
0
def run_melange_manage(command):
    melange_manage = tests.melange_bin_path('melange-manage')
    config_file = tests.test_config_file()
    return functional.execute("%(melange_manage)s %(command)s "
                              "--config-file=%(config_file)s" % locals())
Exemple #12
0
def setup():
    options = {"config_file": tests.test_config_file()}
    conf = config.Config.load_paste_config("melange", options, None)

    db_api.db_reset(conf, db_based_ip_generator, db_based_mac_generator)