details:   https://code.openbravo.com/erp/devel/pi/rev/cf31b874f2d2
changeset: 34167:cf31b874f2d2
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Tue Jun 05 13:19:34 2018 +0200
summary:   related to issue 38635: added test case

diffstat:

 src-test/src/org/openbravo/test/datasource/FICTest.java |  35 ++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diffs (50 lines):

diff -r 909e2725902f -r cf31b874f2d2 
src-test/src/org/openbravo/test/datasource/FICTest.java
--- a/src-test/src/org/openbravo/test/datasource/FICTest.java   Tue Jun 05 
11:29:06 2018 +0200
+++ b/src-test/src/org/openbravo/test/datasource/FICTest.java   Tue Jun 05 
13:19:34 2018 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -102,4 +102,37 @@
     // ...and compare it with the returned value
     assertThat(ficDateFromValue, startsWith(utcFormattedDateTime));
   }
+
+  /**
+   * Tests that the FIC returns the expected value for a combo which links to 
the parent tab after
+   * clearing the organization field in the sub-tab.
+   * 
+   * See issue #38635
+   */
+  @Test
+  public void selectCorrectComboValueAfterClearingOrgField() throws Exception {
+    final String selectedRoleId = "C7E9112E632348F396B4967517E62805";
+    StringBuilder urlParams = new StringBuilder();
+    urlParams.append("?MODE=CHANGE");
+    urlParams.append("&PARENT_ID=" + selectedRoleId);
+    urlParams.append("&TAB_ID=351"); // Org Access tab
+    urlParams.append("&ROW_ID=null");
+    urlParams.append("&CHANGED_COLUMN=inpadOrgId");
+    urlParams
+        
.append("&_action=org.openbravo.client.application.window.FormInitializationComponent");
+
+    JSONObject content = new JSONObject();
+    content.put("inpadOrgId", "null"); // clearing organization field
+    content.put("inpadRoleId", selectedRoleId);
+
+    String response = doRequest("/org.openbravo.client.kernel" + 
urlParams.toString(),
+        content.toString(), 200, "POST", "application/json");
+
+    JSONObject columnValues = new 
JSONObject(response).getJSONObject("columnValues");
+    assertTrue("AD_Role_ID column should be returned", 
columnValues.has("AD_Role_ID"));
+
+    JSONObject role = columnValues.getJSONObject("AD_Role_ID");
+    assertTrue("AD_Role_ID column value is correct",
+        role.has("value") && selectedRoleId.equals(role.getString("value")));
+  }
 }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to