Esempio n. 1
0
 def test_news(self, feedparser_mock):
     """Test NEWS works."""
     feedparser_mock.return_value = self.d
     news()
     tmp = get_news()
     assert len(tmp) == 1, len(tmp)
     err_msg = "Notify user should be notified"
     assert self.get_notify_users() == '1', err_msg
Esempio n. 2
0
 def test_news(self, feedparser_mock):
     """Test NEWS works."""
     feedparser_mock.return_value = self.d
     news()
     tmp = get_news()
     assert len(tmp) == 1, len(tmp)
     err_msg = "Notify user should be notified"
     assert self.get_notify_users() == '1', err_msg
Esempio n. 3
0
 def test_news(self, feedparser_mock):
     """Test NEWS works."""
     user = UserFactory.create(admin=True)
     feedparser_mock.return_value = self.d
     news()
     tmp = get_news()
     assert len(tmp) == 1, len(tmp)
     err_msg = "Notify user should be notified"
     assert self.get_notify_users(user) == '1', err_msg
Esempio n. 4
0
 def test_news(self, feedparser_mock):
     """Test NEWS works."""
     user = UserFactory.create(admin=True)
     feedparser_mock.return_value = self.d
     news()
     tmp = get_news()
     assert len(tmp) == 1, len(tmp)
     err_msg = "Notify user should be notified"
     assert self.get_notify_users(user) == '1', err_msg
Esempio n. 5
0
 def test_news_no_new_items_no_notification(self, feedparser_mock):
     """Test NEWS no new items no notificaton works."""
     feedparser_mock.return_value = self.d
     news()
     self.delete_notify()
     feedparser_mock.return_value = self.d
     news()
     tmp = get_news()
     assert len(tmp) == 1, len(tmp)
     err_msg = "Notify user should NOT be notified"
     assert self.get_notify_users() == None, err_msg
Esempio n. 6
0
 def test_news_no_new_items_no_notification(self, feedparser_mock):
     """Test NEWS no new items no notificaton works."""
     feedparser_mock.return_value = self.d
     news()
     self.delete_notify()
     feedparser_mock.return_value = self.d
     news()
     tmp = get_news()
     assert len(tmp) == 1, len(tmp)
     err_msg = "Notify user should NOT be notified"
     assert self.get_notify_users() == None, err_msg
Esempio n. 7
0
    def test_news_check_config_urls(self, feedparser_mock):
        """Test NEWS adds config URLs."""
        urls = ['https://github.com/pybossa/pybossa/releases.atom',
                'http://scifabric.com/blog/all.atom.xml',
                'http://url']

        feedparser_mock.return_value = self.d
        with patch.dict(self.flask_app.config, {'NEWS_URL': ['http://url']}):
            news()
            calls = []
            for url in urls:
                calls.append(call(url))
            feedparser_mock.assert_has_calls(calls, any_order=True)
Esempio n. 8
0
    def test_news_check_config_urls(self, feedparser_mock):
        """Test NEWS adds config URLs."""
        urls = ['https://github.com/Scifabric/pybossa/releases.atom',
                'http://scifabric.com/blog/all.atom.xml',
                'http://url']

        feedparser_mock.return_value = self.d
        with patch.dict(self.flask_app.config, {'NEWS_URL': ['http://url']}):
            news()
            calls = []
            for url in urls:
                calls.append(call(url))
            feedparser_mock.assert_has_calls(calls, any_order=True)