forked from Flying-Free/pyopenproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocument_service_test.py
31 lines (24 loc) · 1006 Bytes
/
document_service_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
import os
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.model.document import Document
from tests.test_cases.openproject_test_case import OpenProjectTestCase
class DocumentServiceTestCase(OpenProjectTestCase):
def setUp(self):
super().setUp()
DATA = os.path.join(self.TEST_CASES, '../data/document.json')
self.docSer = self.op.get_document_service()
with open(DATA) as f:
self.document = Document(json.load(f))
def test_find(self):
# TODO: We need a way to create a document using the API
# current = self.docSer.find(self.document)
# self.assertIsNotNone(current)
pass
def test_not_found(self):
# Result is 404
with self.assertRaises(BusinessError):
self.docSer.find(self.document)
def test_find_all(self):
documents = self.docSer.find_all('[["created_at", "asc"]]')
self.assertEqual(0, len(documents))