Esempio n. 1
0
 def test_open_file_attach(self, mock_new_resource):
     fd = open('tests/resources/tasks_list_success.json')
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     task = Task(rm, id=1, project=1)
     task.attach(fd)
     mock_new_resource.assert_called_with(
         files={'attached_file': fd},
         payload={'project': 1, 'object_id': 1}
     )
Esempio n. 2
0
 def test_file_attach(self, mock_new_resource, mock_open):
     fd = open('tests/resources/tasks_list_success.json')
     mock_open.return_value = fd
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     task = Task(rm, id=1, project=1)
     task.attach('tests/resources/tasks_list_success.json')
     mock_new_resource.assert_called_with(
         files={'attached_file': fd},
         payload={'project': 1, 'object_id': 1}
     )
Esempio n. 3
0
 def test_open_file_attach(self, mock_new_resource):
     fd = open("tests/resources/tasks_list_success.json")
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     task = Task(rm, id=1, project=1)
     task.attach(fd)
     mock_new_resource.assert_called_with(files={"attached_file": fd},
                                          payload={
                                              "project": 1,
                                              "object_id": 1
                                          })