def test_delete_on_existent_file(self): self.fakeFile = self.get_dummy_file() realpath = os.path.join(GLSettings.static_path, self.fakeFile['name']) dumped_file = yield write_upload_plaintext_to_disk(self.fakeFile, realpath) handler = self.request({}, role='admin') yield handler.delete(self.fakeFile['name'])
def test_delete_on_existent_file(self): self.fakeFile = self.get_dummy_file() realpath = os.path.join(GLSettings.static_path, self.fakeFile['name']) yield write_upload_plaintext_to_disk(self.fakeFile, realpath) handler = self.request({}, role='admin') yield handler.delete(self.fakeFile['name'])
def test_get_list_of_files(self): self.fakeFile = self.get_dummy_file() realpath = os.path.join(GLSettings.static_path, self.fakeFile['name']) yield write_upload_plaintext_to_disk(self.fakeFile, realpath) handler = self.request(role='admin') response = yield handler.get() found = False for f in response: if f['name'] == self.fakeFile['name']: found = True break self.assertTrue(found)
def test_get_list_of_files(self): self.fakeFile = self.get_dummy_file() realpath = os.path.join(GLSettings.static_path, self.fakeFile['name']) dumped_file = yield write_upload_plaintext_to_disk(self.fakeFile, realpath) handler = self.request(role='admin') yield handler.get() self.assertTrue(isinstance(self.responses[0], list)) found = False for f in self.responses[0]: if f['name'] == self.fakeFile['name']: found = True break self.assertTrue(found)