Exemplo n.º 1
0
    def test_config_management(self, service):
        # Config management isn't very common, doesn't merit direct addition to service.
        configs = PropagatorConfigs(service.rest)

        project = service.new_working_project()
        assert project is not None

        config = configs.new_config({'project': project.get_uuid(), 'description': 'test config'})
        assert project.get_uuid() == config.get_project()

        my_configs = configs.get_configs()
        assert config.get_uuid() in [c.get_uuid() for c in my_configs]

        config_again = configs.get_config(config.get_uuid())
        assert config.get_config_json() == config_again.get_config_json()

        configs.delete_config(config.get_uuid())

        my_configs = configs.get_configs()
        assert config.get_uuid() not in [c.get_uuid() for c in my_configs]
    def test_config_management(self):
        # Config management isn't very common, doesn't merit direct addition to service.
        configs = PropagatorConfigs(self.service.rest)

        project = self.service.new_working_project()
        self.assertIsNotNone(project)

        config = configs.new_config({
            'project': project.get_uuid(),
            'description': 'test config'
        })
        self.assertEqual(project.get_uuid(), config.get_project())

        my_configs = configs.get_configs()
        self.assertIn(config.get_uuid(), [c.get_uuid() for c in my_configs])

        config_again = configs.get_config(config.get_uuid())
        self.assertEqual(config.get_config_json(),
                         config_again.get_config_json())

        configs.delete_config(config.get_uuid())

        my_configs = configs.get_configs()
        self.assertNotIn(config.get_uuid(), [c.get_uuid() for c in my_configs])
Exemplo n.º 3
0
    def test_delete_config(self):
        rest = _RestProxyForTest()
        configs = PropagatorConfigs(rest)

        rest.expect_delete("/config/aaa", 204)
        configs.delete_config('aaa')

        # 200 isn't a valid return value for delete calls right now
        rest.expect_delete("/config/aaa", 200)
        with self.assertRaises(RuntimeError):
            configs.delete_config('aaa')

        rest.expect_delete("/config/aaa", 404)
        with self.assertRaises(RuntimeError):
            configs.delete_config('aaa')