def test_save_data(self):
     data = {'title': 'a title', 'summary_detail': 'a content'}
     s = ServicesMgr('')
     title = s.set_title(data)
     content = s.set_content(data)
     self.assertTrue(title)
     self.assertTrue(content)
Beispiel #2
0
 def test_save_data(self, **kwargs):
     data = {'title': 'a title', 'summary_detail': 'a content'}
     s = ServicesMgr('')
     title = s.set_title(data)
     content = s.set_content(data)
     self.assertTrue(title)
     self.assertTrue(content)
    def setUp(self):
        super(ServicesMgrTestCase, self).setUp()
        arg = ''
        self.service = ServicesMgr(arg)
        self.service.consumer_key = 'azerty'
        self.service.consumer_secret = 'qsdfghjk'

        self.oauth = 'oauth1'
        self.request = Client()
class ServicesMgrTestCase(MainTest):

    def setUp(self):
        super(ServicesMgrTestCase, self).setUp()
        arg = ''
        self.service = ServicesMgr(arg)
        self.service.consumer_key = 'azerty'
        self.service.consumer_secret = 'qsdfghjk'

        self.oauth = 'oauth1'
        self.request = Client()

    def test_set_title(self):
        data = {'title': 'foobar'}
        self.assertTrue('title' in data)
        data = {'link': 'http://localhost/url/to/news'}
        self.assertTrue('title' not in data)
        self.assertTrue('link' in data)

    def test_set_content_summary(self):
        data = {'summary_detail': 'some summary'}
        res = self.service.set_content(data)
        self.assertTrue(type(res) is str)

    def test_set_content_description(self):
        data = {'description': 'foobar'}
        res = self.service.set_content(data)
        self.assertTrue(type(res) is str)

    def test_set_content_empty(self):
        data = {'content': ''}
        res = self.service.set_content(data)
        self.assertTrue(type(res) is str)

    def test_set_content(self):
        content = list()
        content.append({'foobar': 'value'})
        data = {'content': content}
        res = self.service.set_content(data)
        self.assertTrue(type(res) is str)

    def test_save_data(self):
        trigger_id = 1
        data = {'title': 'a title', 'summary_detail': 'a content'}
        data['output_format'] = 'md'
        title, content = self.service.save_data(trigger_id, **data)
        self.assertTrue(title)
        self.assertTrue(content)
 def test_send_digest_event(self):
     self.create_triggerservice()
     se = ServicesMgr(arg="foobar", token="AZERTY123")
     se.send_digest_event(1, 'foobar')
 def test_reset_failed(self):
     se = ServicesMgr(arg="foobar", token="AZERTY123")
     se.reset_failed(1)
 def test_callback(self):
     request = RequestFactory().get('/th/')
     se = ServicesMgr(arg="foobar", token="AZERTY123")
     se.service = 'ServiceWallabag'
     callback = se.callback_url(request)
     self.assertTrue(type(callback) is str)
 def test_send_digest_event(self):
     self.create_triggerservice()
     se = ServicesMgr(arg="foobar", token="AZERTY123")
     se.send_digest_event(1, 'foobar')
 def test_reset_failed(self):
     se = ServicesMgr(arg="foobar", token="AZERTY123")
     se.reset_failed(1)
 def test_callback(self):
     request = RequestFactory().get('/th/')
     se = ServicesMgr(arg="foobar", token="AZERTY123")
     se.service = 'ServiceWallabag'
     callback = se.callback_url(request)
     self.assertTrue(type(callback) is str)