Пример #1
0
 def test_get_sites(self):
     # Get Site objects array, [Site, Site, Site...]
     dao = SiteDAO()
     self._register_node(dao)
     
     sites = dao.get_sites()
     self.assertEqual(len(sites), 1)
     self.assertEqual(len(sites['site1'].nodes.keys()), 1)
Пример #2
0
    def test_unregister_node(self):
        node1 = {
            'name': 'node1',
            'site': 'site1',
            'url' : 'http://node1'
        }

        dao = SiteDAO()
        dao.register_node(node1)

        self.assertEqual(len(dao.nodes('site1').keys()), 1)

        dao.unregister_node(node1)
        self.assertEqual(len(dao.nodes('site1').keys()), 0)

        sites = dao.get_sites()
        self.assertEqual(len(sites.keys()), 0)
Пример #3
0
def show_sites(request):
    dao = SiteDAO()
    
    return { 'sites': dao.get_sites() }