Commit 7e71bedda18d55b3918a490c2095f66f8ff2114a

Authored by conradverm
1 parent 7cd0dec6

WSA-57

"Checkout functions should return document detail"
Updated.

WSA-56
"rename document_detail.updated fields to be document_detail.modified to be consistent with normal interface"
Updated.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7657 c91229c3-7414-0410-bfa2-8a42b809f60b
ktwebservice/nunit/document_add.cs
... ... @@ -121,9 +121,9 @@ namespace MonoTests.KnowledgeTree
121 121 Assert.AreEqual("Administrator", response1.created_by);
122 122  
123 123 //Assert.IsTrue(response1.updated_date == null);
124   - Assert.IsTrue("" != response1.updated_date);
  124 + Assert.IsTrue("" != response1.modified_date);
125 125  
126   - Assert.AreEqual("Administrator", response1.updated_by);
  126 + Assert.AreEqual("Administrator", response1.modified_by);
127 127  
128 128 Assert.IsTrue(response1.document_id > 0);
129 129  
... ... @@ -203,10 +203,10 @@ namespace MonoTests.KnowledgeTree
203 203  
204 204 Assert.AreEqual("Administrator", response1.created_by);
205 205  
206   - //Assert.IsTrue(response1.updated_date == null);
207   - Assert.IsTrue("" != response1.updated_date);
  206 + //Assert.IsTrue(response1.modified_date == null);
  207 + Assert.IsTrue("" != response1.modified_date);
208 208  
209   - Assert.AreEqual("Administrator", response1.updated_by);
  209 + Assert.AreEqual("Administrator", response1.modified_by);
210 210  
211 211 Assert.IsTrue(response1.document_id > 0);
212 212  
... ...
ktwebservice/nunit/document_checkout.cs
... ... @@ -69,12 +69,15 @@ namespace MonoTests.KnowledgeTree
69 69  
70 70 if (this._verbose) System.Console.WriteLine("Checking out document : " + filename);
71 71  
72   - kt_response response = this._kt.checkout_base64_document(this._session, this._docId, "unit test - going to checkout and then undo", false);
  72 + kt_document_detail response = this._kt.checkout_base64_document(this._session, this._docId, "unit test - going to checkout and then undo", false);
73 73 Assert.AreEqual(0, response.status_code);
74   -
  74 + Assert.AreEqual("Administrator",response.checked_out_by);
  75 + Assert.IsTrue(null != response.checked_out_date);
75 76  
76 77 response = this._kt.undo_document_checkout(this._session, this._docId, "unit test - doing undo");
77 78 Assert.AreEqual(0, response.status_code);
  79 + Assert.AreEqual("n/a",response.checked_out_by);
  80 + Assert.AreEqual("n/a", response.checked_out_date);
78 81 }
79 82  
80 83 [Test]
... ... @@ -84,14 +87,16 @@ namespace MonoTests.KnowledgeTree
84 87  
85 88 if (this._verbose) System.Console.WriteLine("Checking out document : " + filename);
86 89  
87   - kt_response response = this._kt.checkout_base64_document(this._session, this._docId, "unit test - going to checkout and then checkin", false);
  90 + kt_document_detail response = this._kt.checkout_base64_document(this._session, this._docId, "unit test - going to checkout and then checkin", false);
88 91 Assert.AreEqual(0, response.status_code);
  92 + Assert.AreEqual("Administrator",response.checked_out_by);
  93 + Assert.IsTrue(null != response.checked_out_date);
89 94  
90 95  
91 96 kt_document_detail checkin = this._kt.checkin_base64_document(this._session, this._docId, filename, "unit test - doing checkin", Helper.ConvertFileToBase64Encoding(this._filename), false);
92 97 Assert.AreEqual(0, checkin.status_code);
93   -
94   - //assert - check data checkout
  98 + Assert.AreEqual("n/a",checkin.checked_out_by);
  99 + Assert.AreEqual("n/a", checkin.checked_out_date);
95 100 }
96 101  
97 102 [Test]
... ... @@ -101,9 +106,10 @@ namespace MonoTests.KnowledgeTree
101 106  
102 107 if (this._verbose) System.Console.WriteLine("Checking out document : " + filename);
103 108  
104   - kt_response response = this._kt.checkout_document(this._session, this._docId, "unit test - going to checkout and then checkin", false);
  109 + kt_document_detail response = this._kt.checkout_document(this._session, this._docId, "unit test - going to checkout and then checkin", false);
105 110 Assert.AreEqual(0, response.status_code);
106   -
  111 + Assert.AreEqual("Administrator",response.checked_out_by);
  112 + Assert.IsTrue(null != response.checked_out_date);
107 113  
108 114 FileUploader uploader = new FileUploader("http://ktdms.trunk/ktwebservice/upload.php");
109 115  
... ... @@ -111,7 +117,9 @@ namespace MonoTests.KnowledgeTree
111 117 String tempname = uploader.getFilename();
112 118  
113 119 kt_document_detail checkin = this._kt.checkin_document(this._session, this._docId, filename, "unit test - doing checkin", tempname, false);
114   - Assert.AreEqual(0, checkin.status_code);
  120 + Assert.AreEqual(0, checkin.status_code);
  121 + Assert.AreEqual("n/a",checkin.checked_out_by);
  122 + Assert.AreEqual("n/a", checkin.checked_out_date);
115 123 }
116 124  
117 125  
... ...
ktwebservice/nunit/document_system_metadata.cs
... ... @@ -64,13 +64,16 @@ namespace MonoTests.KnowledgeTree
64 64 fs[0].fields[2].name = "Media Type";
65 65 fs[0].fields[2].value = "Text";
66 66  
67   - kt_sysdata_item[] sysdata = new kt_sysdata_item[2];
  67 + kt_sysdata_item[] sysdata = new kt_sysdata_item[3];
68 68 sysdata[0] = new kt_sysdata_item();
69 69 sysdata[0].name = "created_by";
70 70 sysdata[0].value = "Anonymous";
71 71 sysdata[1] = new kt_sysdata_item();
72 72 sysdata[1].name = "created_date";
73 73 sysdata[1].value = "2007-01-17";
  74 + sysdata[2] = new kt_sysdata_item();
  75 + sysdata[2].name = "modified_by";
  76 + sysdata[2].value = "admin";
74 77  
75 78  
76 79 kt_document_detail update_resp = this._kt.update_document_metadata(this._session, this._doc1.docId, fs, sysdata);
... ... @@ -88,6 +91,8 @@ namespace MonoTests.KnowledgeTree
88 91  
89 92 Assert.AreEqual("Anonymous", update_resp.created_by);
90 93 Assert.AreEqual("2007-01-17 00:00:00", update_resp.created_date);
  94 + Assert.AreEqual("Administrator", update_resp.modified_by);
  95 + Assert.AreEqual("2007-01-17 00:00:00", update_resp.created_date);
91 96 }
92 97  
93 98 [Test]
... ... @@ -159,7 +164,7 @@ namespace MonoTests.KnowledgeTree
159 164 sysdata[1].name = "created_date";
160 165 sysdata[1].value = "2007-01-17";
161 166  
162   - kt_response resp = this._kt.checkout_base64_document(this._session, this._doc1.docId, "test checkin", false);
  167 + kt_document_detail resp = this._kt.checkout_base64_document(this._session, this._doc1.docId, "test checkin", false);
163 168 Assert.AreEqual(0, resp.status_code);
164 169  
165 170  
... ...