def test_get_open_datarequests_badge_true(self):
        # Mocking
        n_datarequests = 3
        helpers.db.DataRequest.get_open_datarequests_number.return_value = n_datarequests

        # Call the function
        result = helpers.get_open_datarequests_badge(True)

        # Assertions
        helpers.db.init_db.assert_called_once_with(helpers.model)
        helpers.db.DataRequest.get_open_datarequests_number.assert_called_once_with()
        self.assertEquals(result, helpers.tk.render_snippet.return_value)
        helpers.tk.render_snippet.assert_called_once_with('datarequests/snippets/badge.html',
                                                          {'comments_count': n_datarequests})
    def test_get_open_datarequests_badge_true(self):
        # Mocking
        n_datarequests = 3
        helpers.db.DataRequest.get_open_datarequests_number.return_value = n_datarequests

        # Call the function
        result = helpers.get_open_datarequests_badge(True)

        # Assertions
        helpers.db.init_db.assert_called_once_with(helpers.model)
        helpers.db.DataRequest.get_open_datarequests_number.assert_called_once_with(
        )
        self.assertEquals(result, helpers.tk.render_snippet.return_value)
        helpers.tk.render_snippet.assert_called_once_with(
            'datarequests/snippets/badge.html',
            {'comments_count': n_datarequests})
 def test_get_open_datarequests_badge_false(self):
     self.assertEquals(helpers.get_open_datarequests_badge(False), '')
 def test_get_open_datarequests_badge_false(self):
     self.assertEquals(helpers.get_open_datarequests_badge(False), '')