s4-smbtorture: unify test list to run against single created printers in RPC-SPOOLSS...
[abartlet/samba.git/.git] / source4 / torture / rpc / spoolss.c
index 53b1fe4e8278471b0d1ba5fcfed7ed9d75393460..0c9c076fda35f0884fb49249bd29533f00bdba08 100644 (file)
@@ -1973,6 +1973,27 @@ static bool test_PrinterInfo_DevModes(struct torture_context *tctx,
 
        torture_assert(tctx, test_devicemode_equal(tctx, devmode, devmode2), "");
 
+
+       /* set devicemode level 2 and see if it persists */
+
+       devmode->copies = 39;
+       devmode->formname = talloc_strdup(tctx, "Letter");
+
+       torture_assert(tctx, test_devmode_set_level(tctx, p, handle, 8, devmode), "");
+
+       torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 8, &info), "");
+
+       devmode2 = info.info8.devmode;
+
+       torture_assert(tctx, test_devicemode_equal(tctx, devmode, devmode2), "");
+
+       torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 2, &info), "");
+
+       devmode2 = info.info2.devmode;
+
+       torture_assert(tctx, test_devicemode_equal(tctx, devmode, devmode2), "");
+
+
        return true;
 }
 
@@ -4301,6 +4322,32 @@ bool test_printer_keys(struct torture_context *tctx,
        return true;
 }
 
+static bool test_one_printer(struct torture_context *tctx,
+                            struct dcerpc_pipe *p,
+                            struct policy_handle *handle,
+                            const char *name)
+{
+       bool ret = true;
+
+       if (!test_printer_info(tctx, p, handle)) {
+               ret = false;
+       }
+
+       if (!test_PrinterInfo_SD(tctx, p, handle)) {
+               ret = false;
+       }
+
+       if (!test_PrinterInfo_DevMode(tctx, p, handle, name)) {
+               ret = false;
+       }
+
+       if (!test_printer_keys(tctx, p, handle)) {
+               ret = false;
+       }
+
+       return ret;
+}
+
 static bool test_printer(struct torture_context *tctx,
                         struct dcerpc_pipe *p)
 {
@@ -4316,19 +4363,7 @@ static bool test_printer(struct torture_context *tctx,
                return false;
        }
 
-       if (!test_printer_info(tctx, p, &handle[0])) {
-               ret = false;
-       }
-
-       if (!test_PrinterInfo_SD(tctx, p, &handle[0])) {
-               ret = false;
-       }
-
-       if (!test_PrinterInfo_DevMode(tctx, p, &handle[0], TORTURE_PRINTER)) {
-               ret = false;
-       }
-
-       if (!test_printer_keys(tctx, p, &handle[0])) {
+       if (!test_one_printer(tctx, p, &handle[0], TORTURE_PRINTER)) {
                ret = false;
        }
 
@@ -4349,11 +4384,7 @@ static bool test_printer(struct torture_context *tctx,
                return false;
        }
 
-       if (!test_printer_info(tctx, p, &handle[1])) {
-               ret = false;
-       }
-
-       if (!test_printer_keys(tctx, p, &handle[1])) {
+       if (!test_one_printer(tctx, p, &handle[1], TORTURE_PRINTER_EX)) {
                ret = false;
        }