Esempio n. 1
0
 def test_get_associations(self):
     fixture.init_tree(self.jones)
     assocs = self.jones.associations.get_all()
     for host in fixture.ASSOCIATIONS:
         self.assertEquals(
             assocs[host],
             self.jones._get_view_path(fixture.ASSOCIATIONS[host]))
Esempio n. 2
0
    def test_jones(self):

        fixture.init_tree(self.jones)
        self.assertEquals(
            fixture.CHILD1,
            self.jones.get_config('127.0.0.2')
        )
Esempio n. 3
0
 def test_get_associations(self):
     fixture.init_tree(self.jones)
     assocs = self.jones.associations.get_all()
     for host in fixture.ASSOCIATIONS:
         self.assertEquals(
             assocs[host],
             self.jones._get_view_path(fixture.ASSOCIATIONS[host])
         )
Esempio n. 4
0
 def test_delete_association(self):
     fixture.init_tree(self.jones)
     self.jones.delete_association('127.0.0.3')
     self.assertRaises(
         KeyError,
         self.jones.get_config,
         '127.0.0.3'
     )
     self.assertTrue(len(self.jones.associations.get_all()) > 0)
Esempio n. 5
0
    def test_delete_config(self):
        fixture.init_tree(self.jones)
        env = Env('parent/child1')
        self.jones.delete_config(env, -1)

        self.assertRaises(NoNodeException, self.jones.get_config, '127.0.0.2')

        self.assertRaises(NoNodeException, self.jones.get_config_by_env, env)

        self.assertRaises(NoNodeException, self.jones.get_view_by_env, env)
Esempio n. 6
0
    def setUp(self):
        super(TestJonesClient, self).setUp()
        self.config = None
        self.service = 'testservice'
        self.hostname = '127.0.0.2'
        self.ev = threading.Event()

        self.jones = Jones(self.service, self.client)
        fixture.init_tree(self.jones)
        self.jones_client = JonesClient(self.client, self.service,
                                        self.default_cb, self.hostname)
Esempio n. 7
0
    def setUp(self):
        super(TestJonesClient, self).setUp()
        self.config = None
        self.service = 'testservice'
        self.hostname = '127.0.0.2'
        self.ev = threading.Event()

        self.jones = Jones(self.service, self.client)
        fixture.init_tree(self.jones)
        self.jones_client = JonesClient(self.client, self.service,
                                        self.default_cb, self.hostname)
Esempio n. 8
0
    def test_parent_changed(self):
        fixture.init_tree(self.jones)
        parent = dict(fixture.CONFIG['parent'])
        parent['new'] = 'key'
        self.jones.set_config(Env('parent'), parent, 0)
        #self.client.print_tree('/services')

        for i in ('127.0.0.1', '127.0.0.2'):
            config = self.jones.get_config(i)
            self.assertEquals(config.get('b'), [1, 2, 3],
                              "Host %s didn't inherit properly." % i)
            self.assertEquals(config.get('new'), 'key',
                              "Host %s not updated." % i)
Esempio n. 9
0
    def test_parent_changed(self):
        fixture.init_tree(self.jones)
        parent = dict(fixture.CONFIG['parent'])
        parent['new'] = 'key'
        self.jones.set_config(Env('parent'), parent, 0)
        #self.client.print_tree('/services')

        for i in ('127.0.0.1', '127.0.0.2'):
            config = self.jones.get_config(i)
            self.assertEquals(config.get('b'), [1, 2, 3],
                              "Host %s didn't inherit properly." % i)
            self.assertEquals(config.get('new'), 'key',
                              "Host %s not updated." % i)
Esempio n. 10
0
    def test_delete_config(self):
        fixture.init_tree(self.jones)
        env = Env('parent/child1')
        self.jones.delete_config(env, -1)

        self.assertRaises(
            NoNodeException,
            self.jones.get_config,
            '127.0.0.2'
        )

        self.assertRaises(
            NoNodeException,
            self.jones.get_config_by_env,
            env
        )

        self.assertRaises(
            NoNodeException,
            self.jones.get_view_by_env,
            env
        )
Esempio n. 11
0
    def test_jones(self):

        fixture.init_tree(self.jones)
        self.assertEquals(fixture.CHILD1, self.jones.get_config('127.0.0.2'))
Esempio n. 12
0
 def test_delete_association(self):
     fixture.init_tree(self.jones)
     self.jones.delete_association('127.0.0.3')
     self.assertRaises(KeyError, self.jones.get_config, '127.0.0.3')
     self.assertTrue(len(self.jones.associations.get_all()) > 0)