Ejemplo n.º 1
0
def test_forum_save(category, moderator_user):
    """Test the save forum method"""
    forum = Forum(title="Test Forum", category_id=category.id)
    forum.moderators = [moderator_user]
    forum.save()

    assert forum.title == "Test Forum"
    assert forum.moderators == [moderator_user]
Ejemplo n.º 2
0
def test_forum_save(category, moderator_user):
    """Test the save forum method"""
    forum = Forum(title="Test Forum", category_id=category.id)
    forum.moderators = [moderator_user]
    forum.save()

    assert forum.title == "Test Forum"
    assert forum.moderators == [moderator_user]
Ejemplo n.º 3
0
    def save(self):
        forum = Forum(title=self.title.data,
                      description=self.description.data,
                      position=self.position.data,
                      external=self.external.data,
                      show_moderators=self.show_moderators.data,
                      locked=self.locked.data)

        if self.moderators.data:
            # is already validated
            forum.moderators = self.moderators.data

        forum.category_id = self.category.data.id

        return forum.save()
Ejemplo n.º 4
0
    def save(self):
        forum = Forum(title=self.title.data,
                      description=self.description.data,
                      position=self.position.data,
                      external=self.external.data,
                      show_moderators=self.show_moderators.data,
                      locked=self.locked.data)

        if self.moderators.data:
            # is already validated
            forum.moderators = self.moderators.data

        forum.category_id = self.category.data.id

        return forum.save()
Ejemplo n.º 5
0
    def save(self):
        forum = Forum(title=self.title.data,
                      description=self.description.data,
                      position=self.position.data)

        if self.moderators.data and not self.is_category.data:
            forum.moderators = self.moderators.data

        if self.is_category.data:
            forum.is_category = True
            forum.parent_id = None
        else:
            forum.parent_id = self.parent.data.id

        return forum.save()