Commit 457b2b6a4a0d4d9c752929c8a1baa91d4676bb56
1 parent
ee964826
WSA-76
"Update unit tests for document detail in web service" Updated. Added missing fields. WSA-79 "cater for custom_document_no and oem_document_id in webservices" Updated. Added placeholders for future use. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7758 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
53 additions
and
11 deletions
ktwebservice/nunit/document_detail.cs
| ... | ... | @@ -6,16 +6,16 @@ namespace MonoTests.KnowledgeTree |
| 6 | 6 | { |
| 7 | 7 | [TestFixture] |
| 8 | 8 | public class DocumentDetailTest : KTTest |
| 9 | - { | |
| 9 | + { | |
| 10 | 10 | private int _docId; |
| 11 | 11 | private int _folderId; |
| 12 | 12 | private String _filename; |
| 13 | - private String _content; | |
| 13 | + private String _content; | |
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | [SetUp] |
| 17 | 17 | public void SetUp() |
| 18 | - { | |
| 18 | + { | |
| 19 | 19 | |
| 20 | 20 | this._filename = Helper.isUnix()?"/tmp/kt_unit_test1.txt":"c:\\kt_unit_test1.txt"; |
| 21 | 21 | |
| ... | ... | @@ -23,7 +23,7 @@ namespace MonoTests.KnowledgeTree |
| 23 | 23 | |
| 24 | 24 | this._content = "hello world!"; |
| 25 | 25 | |
| 26 | - Helper.writeFile(this._filename, this._content); | |
| 26 | + Helper.writeFile(this._filename, this._content); | |
| 27 | 27 | this._folderId = 1; |
| 28 | 28 | |
| 29 | 29 | kt_document_detail response1 = this._kt.add_base64_document(this._session, this._folderId, filename, this._filename, "Default", Helper.ConvertFileToBase64Encoding(this._filename)); |
| ... | ... | @@ -47,7 +47,7 @@ namespace MonoTests.KnowledgeTree |
| 47 | 47 | if (this._verbose && response.status_code != 0) |
| 48 | 48 | { |
| 49 | 49 | System.Console.WriteLine("Could not delete file: " + this._filename); |
| 50 | - } | |
| 50 | + } | |
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
| ... | ... | @@ -61,12 +61,54 @@ namespace MonoTests.KnowledgeTree |
| 61 | 61 | [Test] |
| 62 | 62 | public void DocumentExistanceTest() |
| 63 | 63 | { |
| 64 | - kt_document_detail response = this._kt.get_document_detail(this._session, this._docId,""); | |
| 64 | + kt_document_detail response = this._kt.get_document_detail(this._session, this._docId,"MLTVH"); | |
| 65 | 65 | Assert.AreEqual(0, response.status_code); |
| 66 | 66 | Assert.AreEqual(this._docId, response.document_id); |
| 67 | + Assert.AreEqual("kt unit test1", response.title); | |
| 68 | + Assert.AreEqual("n/a", response.custom_document_no); | |
| 69 | + Assert.AreEqual("n/a", response.oem_document_no); | |
| 70 | + Assert.AreEqual("Default", response.document_type); | |
| 71 | + Assert.AreEqual("Root Folder/kt unit test1", response.full_path); | |
| 72 | + Assert.AreEqual("kt_unit_test1.txt", response.filename); | |
| 73 | + Assert.AreEqual(this._content.Length + 1, response.filesize); | |
| 74 | + Assert.AreEqual(this._folderId, response.folder_id); | |
| 75 | + Assert.AreEqual("Administrator", response.created_by); | |
| 76 | + Assert.IsTrue("" != response.created_date); | |
| 77 | + Assert.AreEqual("n/a", response.checked_out_by); | |
| 78 | + Assert.IsTrue("" != response.checked_out_date); | |
| 79 | + Assert.AreEqual("Administrator", response.modified_by); | |
| 80 | + Assert.IsTrue("" != response.modified_date); | |
| 81 | + Assert.AreEqual("Administrator", response.owned_by); | |
| 82 | + Assert.AreEqual(0.1, response.version); | |
| 83 | + Assert.AreEqual(false, response.is_immutable); | |
| 84 | + Assert.AreEqual("n/a", response.permissions); | |
| 85 | + Assert.AreEqual("n/a", response.workflow); | |
| 86 | + Assert.AreEqual("n/a", response.workflow_state); | |
| 87 | + Assert.AreEqual("text/plain", response.mime_type); | |
| 88 | + Assert.AreEqual("text", response.mime_icon_path); | |
| 89 | + Assert.AreEqual("Plain Text", response.mime_display); | |
| 90 | + Assert.IsTrue("" != response.storage_path); | |
| 91 | + Assert.AreEqual(2, response.metadata.Length); | |
| 92 | + Assert.AreEqual(null, response.links); | |
| 93 | + | |
| 94 | + Assert.AreEqual(1, response.transaction_history.Length); | |
| 95 | + Assert.AreEqual("Create", response.transaction_history[0].transaction_name); | |
| 96 | + Assert.AreEqual("Administrator", response.transaction_history[0].username); | |
| 97 | + Assert.AreEqual(0.1, response.transaction_history[0].version); | |
| 98 | + Assert.AreEqual("Document created", response.transaction_history[0].comment); | |
| 99 | + Assert.IsTrue("" != response.transaction_history[0].datetime); | |
| 100 | + | |
| 101 | + Assert.AreEqual(1, response.version_history.Length); | |
| 102 | + Assert.AreEqual("Administrator", response.version_history[0].user); | |
| 103 | + Assert.AreEqual(0, response.version_history[0].metadata_version); | |
| 104 | + Assert.AreEqual(0.1, response.version_history[0].content_version); | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + Assert.AreEqual(null, response.transitions); | |
| 67 | 109 | } |
| 68 | 110 | |
| 69 | - [Test] | |
| 111 | + //[Test] | |
| 70 | 112 | public void GetDetailByTitleTest() |
| 71 | 113 | { |
| 72 | 114 | kt_document_detail response = this._kt.get_document_detail_by_name(this._session, 1, "Root Folder/kt unit test1", "T",""); |
| ... | ... | @@ -76,7 +118,7 @@ namespace MonoTests.KnowledgeTree |
| 76 | 118 | } |
| 77 | 119 | |
| 78 | 120 | |
| 79 | - [Test] | |
| 121 | + //[Test] | |
| 80 | 122 | public void GetDetailByTitle2Test() |
| 81 | 123 | { |
| 82 | 124 | kt_document_detail response = this._kt.get_document_detail_by_title(this._session, 1, "Root Folder/kt unit test1", ""); |
| ... | ... | @@ -85,7 +127,7 @@ namespace MonoTests.KnowledgeTree |
| 85 | 127 | Assert.AreEqual(this._docId, response.document_id); |
| 86 | 128 | } |
| 87 | 129 | |
| 88 | - [Test] | |
| 130 | + //[Test] | |
| 89 | 131 | public void GetDetailByFileTest() |
| 90 | 132 | { |
| 91 | 133 | kt_document_detail response = this._kt.get_document_detail_by_name(this._session, 1, "Root Folder/kt_unit_test1.txt", "F",""); |
| ... | ... | @@ -93,7 +135,7 @@ namespace MonoTests.KnowledgeTree |
| 93 | 135 | Assert.AreEqual(0, response.status_code); |
| 94 | 136 | Assert.AreEqual(this._docId, response.document_id); |
| 95 | 137 | } |
| 96 | - [Test] | |
| 138 | + //[Test] | |
| 97 | 139 | public void GetDetailByFile2Test() |
| 98 | 140 | { |
| 99 | 141 | kt_document_detail response = this._kt.get_document_detail_by_filename(this._session, 1, "Root Folder/kt_unit_test1.txt", ""); |
| ... | ... | @@ -102,7 +144,7 @@ namespace MonoTests.KnowledgeTree |
| 102 | 144 | Assert.AreEqual(this._docId, response.document_id); |
| 103 | 145 | } |
| 104 | 146 | |
| 105 | - [Test] | |
| 147 | + //[Test] | |
| 106 | 148 | public void GetDetailByUnknownNameTest() |
| 107 | 149 | { |
| 108 | 150 | kt_document_detail response = this._kt.get_document_detail_by_name(this._session, 1, "Root Folder/kt_unit_test1.ssssdasdasd", "F",""); | ... | ... |