Exemplo n.º 1
0
 def test_save_data3(self):
     """
        token is empty
     """
     data = {'link': '', 'title': '', 'content': ''}
     self.token = ''
     se = ServiceTodoist(self.token)
     res = se.save_data(self.trigger_id, **data)
     self.assertFalse(res)
Exemplo n.º 2
0
 def test_save_data3(self):
     """
        token is empty
     """
     data = {'link': '',
             'title': '',
             'content': ''}
     self.token = ''
     se = ServiceTodoist(self.token)
     res = se.save_data(self.trigger_id, **data)
     self.assertFalse(res)
Exemplo n.º 3
0
    def test_read_data(self):
        """
           Test if the creation of the Todoist object looks fine
        """
        kwargs = dict({'date_triggered': '2013-05-11 13:23:58+00:00',
                       'trigger_id': self.trigger_id,
                       'model_name': 'Todoist'})

        with patch.object(TodoistAPI, 'sync') as mock_read_data:
            se = ServiceTodoist(self.token)
            se.read_data(**kwargs)
        mock_read_data.assert_called_once_with()
Exemplo n.º 4
0
    def test_read_data(self):
        """
           Test if the creation of the Todoist object looks fine
        """
        kwargs = dict({'date_triggered': '2013-05-11 13:23:58+00:00',
                       'trigger_id': self.trigger_id,
                       'model_name': 'Todoist'})

        with patch.object(TodoistAPI, 'sync') as mock_read_data:
            se = ServiceTodoist(self.token)
            se.read_data(**kwargs)
        mock_read_data.assert_called_once_with()
Exemplo n.º 5
0
 def test_save_data(self):
     """
        Test if the creation of the Todoist object looks fine
     """
     self.create_todoist()
     data = {'link': 'http://foo.bar/some/thing/else/what/else',
             'title': 'what else',
             'content': 'foobar'}
     content = data['title'] + ' ' + data['content'] + ' ' + data['link']
     with patch.object(TodoistAPI, 'add_item') as mock_save_data:
         se = ServiceTodoist(self.token)
         se.save_data(self.trigger_id, **data)
     mock_save_data.assert_called_once_with(content)
Exemplo n.º 6
0
 def test_save_data(self):
     """
        Test if the creation of the Todoist object looks fine
     """
     self.create_todoist()
     data = {'link': 'http://foo.bar/some/thing/else/what/else',
             'title': 'what else',
             'content': 'foobar'}
     content = data['title'] + ' ' + data['content'] + ' ' + data['link']
     print(content)
     with patch.object(TodoistAPI, 'add_item') as mock_save_data:
         se = ServiceTodoist(self.token)
         se.save_data(self.trigger_id, **data)
     mock_save_data.assert_called_once_with(content)
Exemplo n.º 7
0
    def setUp(self):
        """
           create a user
        """
        super(TodoistTest, self).setUp()

        self.token = 'AZERTY123'
        self.trigger_id = 1
        self.service = ServiceTodoist(self.token)