def test_format_map(self):
        domain = Domain()
        domain.domain_id = 252
        domain.domain = "example.com"

        group = Group()
        group.group_id = 252
        group.name = "Test Group 1"

        map = DomainGroupMap()
        map.map_id = 1
        map.group_id = group
        map.domain_id = domain
        map.permissions = 7

        formatted = map.format_map(map)
        self.assertTrue(formatted["can_read"])
        self.assertTrue(formatted["can_write"])
        self.assertTrue(formatted["can_delete"])
        self.assertEquals(formatted["map_id"], map.map_id)
        self.assertEquals(formatted["group"], map.group_id.to_clean_dict())
        self.assertEquals(formatted["domain"], map.domain_id.to_clean_dict())
Beispiel #2
0
    def create_group(self, name):
        group = ModelGroup()
        group.name = name
        group.save()

        return group
Beispiel #3
0
    def create_group(self, name):
        group = ModelGroup()
        group.name = name
        group.save()

        return group