Ejemplo 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')
     wikipage = WikiPage(rm, id=1, project=1)
     wikipage.attach(fd)
     mock_new_resource.assert_called_with(
         files={'attached_file': fd},
         payload={'project': 1, 'object_id': 1}
     )
Ejemplo n.º 2
0
 def test_open_file_attach(self, mock_new_resource):
     fd = open('tests/resources/tasks_list_success.json')
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     wikipage = WikiPage(rm, id=1, project=1)
     wikipage.attach(fd)
     mock_new_resource.assert_called_with(
         files={'attached_file': fd},
         payload={'project': 1, 'object_id': 1}
     )
Ejemplo 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")
     wikipage = WikiPage(rm, id=1, project=1)
     wikipage.attach(fd)
     mock_new_resource.assert_called_with(files={"attached_file": fd},
                                          payload={
                                              "project": 1,
                                              "object_id": 1
                                          })
Ejemplo n.º 4
0
 def test_create_wikipage(self, mock_new_resource):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     mock_new_resource.return_value = WikiPage(rm)
     WikiPages(rm).create(1, 'WikiPage-Slug', 'Some content')
     mock_new_resource.assert_called_with(
         payload={'project': 1, 'slug': 'WikiPage-Slug', 'content': 'Some content'}
     )
Ejemplo n.º 5
0
 def test_create_wikipage(self, mock_new_resource):
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     mock_new_resource.return_value = WikiPage(rm)
     WikiPages(rm).create(1, "WikiPage-Slug", "Some content")
     mock_new_resource.assert_called_with(payload={
         "project": 1,
         "slug": "WikiPage-Slug",
         "content": "Some content"
     })
Ejemplo n.º 6
0
 def test_not_valid_type_file_attach(self):
     rm = RequestMaker("/api/v1", "fakehost", "faketoken")
     wikipage = WikiPage(rm, id=1, project=1)
     self.assertRaises(TaigaException, wikipage.attach, 4)
Ejemplo n.º 7
0
 def test_not_existing_file_attach(self):
     rm = RequestMaker('/api/v1', 'fakehost', 'faketoken')
     wikipage = WikiPage(rm, id=1, project=1)
     self.assertRaises(TaigaException, wikipage.attach, 'not-existing-file')