Пример #1
0
    def test_show_widget_with_component(self):
        poll = Poll(question="fu")
        poll.widget = self.widget
        choice = Choice(description="bar")
        poll.choices.append(choice)
        db.session.add(poll)
        db.session.commit()

        self.login_user(self.admin_user)
        response = self.app.get("/admin/widget/{}".format(self.widget.id))
        self.assertEquals(200, response.status_code)
Пример #2
0
    def test_delete_widget_with_component(self):
        poll = Poll(question="fu")
        poll.widget = self.widget
        choice = Choice(description="bar")
        poll.choices.append(choice)
        db.session.add(poll)
        db.session.commit()

        self.login_user(self.admin_user)
        self.app.get("/admin/widget/{}/delete".format(self.widget.id))
        widget = self._get_model(Widget, name="test_widget")
        poll = self._get_model(Poll, question="fu")
        choice = self._get_model(Choice, description="bar")
        assert widget is None
        assert poll is None
        assert choice is None