You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-08-13 20:05:19 +02:00
Merge branch 'main' of https://github.com/Bayselonarrend/OpenIntegrations
This commit is contained in:
BIN
data.json.gpg
BIN
data.json.gpg
Binary file not shown.
@@ -820,8 +820,8 @@ Function GetRequestHeaders(Val Token, Val Parameters = "")
|
|||||||
|
|
||||||
If ValueIsFilled(Parameters) Then
|
If ValueIsFilled(Parameters) Then
|
||||||
|
|
||||||
JSON = OPI_Tools.JSONString(Parameters, "No");
|
JSON = OPI_Tools.JSONString(Parameters, "None");
|
||||||
JSON = StrReplace(JSON, Chars.VK + Chars.PS, "");
|
JSON = StrReplace(JSON, Chars.CR + Chars.PS, "");
|
||||||
|
|
||||||
Headers.Insert("Dropbox-API-Arg", JSON);
|
Headers.Insert("Dropbox-API-Arg", JSON);
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
// For YAxUnit
|
// For YAxUnit
|
||||||
|
|
||||||
Procedure ExecutableScripts() Export
|
Procedure AndwithполняеымыеСцеtoрии() Export
|
||||||
|
|
||||||
OPI_TestDataRetrieval.FormYAXTests();
|
OPI_TestDataRetrieval.FormYAXTests();
|
||||||
|
|
||||||
@@ -490,7 +490,7 @@ Procedure VKAPI_GetPostStatistics() Export
|
|||||||
|
|
||||||
OPI_TestDataRetrieval.WriteLog(Result, "GetPostStatistics");
|
OPI_TestDataRetrieval.WriteLog(Result, "GetPostStatistics");
|
||||||
|
|
||||||
OPI_TestDataRetrieval.ExpectsThat(Result).HasType("Array").HasLength(2);
|
OPI_TestDataRetrieval.ExpectsThat(Result).HasType("Array").AndмеетДлину(2);
|
||||||
|
|
||||||
OPI_Tools.Pause(5);
|
OPI_Tools.Pause(5);
|
||||||
|
|
||||||
@@ -826,7 +826,7 @@ Procedure VKAPI_CreateProductWithProperties() Export
|
|||||||
OPI_Tools.Pause(5);
|
OPI_Tools.Pause(5);
|
||||||
|
|
||||||
OPI_TestDataRetrieval.ExpectsThat(Result).HasType(TypeMatch);
|
OPI_TestDataRetrieval.ExpectsThat(Result).HasType(TypeMatch);
|
||||||
OPI_TestDataRetrieval.ExpectsThat(Result[Response]["items"]).HasType("Array").HasLength(2);
|
OPI_TestDataRetrieval.ExpectsThat(Result[Response]["items"]).HasType("Array").AndмеетДлину(2);
|
||||||
|
|
||||||
Result = OPI_VK.GroupProducts(ProductsArray, , Parameters);
|
Result = OPI_VK.GroupProducts(ProductsArray, , Parameters);
|
||||||
|
|
||||||
|
@@ -226,7 +226,7 @@ Function ExpectsThat(Value) Export
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
|
|
||||||
Module = GetCommonModule("UTest");
|
Module = GetCommonModule("ЮTest");
|
||||||
Awaiting = TypeOf(Module) = Type("CommonModule");
|
Awaiting = TypeOf(Module) = Type("CommonModule");
|
||||||
Return Module.ExpectsThat(Value);
|
Return Module.ExpectsThat(Value);
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ EndFunction
|
|||||||
|
|
||||||
Function FormYAXTests() Export
|
Function FormYAXTests() Export
|
||||||
|
|
||||||
Module = GetCommonModule("UTTests");
|
Module = GetCommonModule("ЮТTests");
|
||||||
Sections = GetTestingSectionMapping();
|
Sections = GetTestingSectionMapping();
|
||||||
TestTable = GetTestTable();
|
TestTable = GetTestTable();
|
||||||
|
|
||||||
@@ -246,12 +246,12 @@ Function FormYAXTests() Export
|
|||||||
|
|
||||||
CurrentSection = Section.Key;
|
CurrentSection = Section.Key;
|
||||||
Filter = New Structure("Section", CurrentSection);
|
Filter = New Structure("Section", CurrentSection);
|
||||||
SectionTests = TestTable.FindLines(Filter);
|
SectionTests = TestTable.FindRows(Filter);
|
||||||
|
|
||||||
Set = Module.AddTestSet(CurrentSection);
|
Set = Module.AddTestоinыйSet(CurrentSection);
|
||||||
|
|
||||||
For Each Test In SectionTests Do
|
For Each Test In SectionTests Do
|
||||||
Set.AddServerTest(Test.Method, Test.Synonym);
|
Set.AddServerныйTest(Test.Method, Test.Synonym);
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
@@ -290,7 +290,7 @@ Procedure GetDate(Value) Export
|
|||||||
|
|
||||||
Except
|
Except
|
||||||
OOD = New TypeDescription(Date);
|
OOD = New TypeDescription(Date);
|
||||||
Value = OOD.ConvertValue(Value);
|
Value = OOD.AdjustValue(Value);
|
||||||
EndTry;
|
EndTry;
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
@@ -298,7 +298,7 @@ EndProcedure
|
|||||||
Procedure GetNumber(Value) Export
|
Procedure GetNumber(Value) Export
|
||||||
|
|
||||||
TypeDescription = New TypeDescription("Number");
|
TypeDescription = New TypeDescription("Number");
|
||||||
Value = TypeDescription.ConvertValue(Value);
|
Value = TypeDescription.AdjustValue(Value);
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
@@ -293,7 +293,7 @@ Function JsonToStructure(Val Text) Export
|
|||||||
|
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Function JSONString(Val Data, Val Escaping = "No") Export
|
Function JSONString(Val Data, Val Escaping = "None") Export
|
||||||
|
|
||||||
JSONParameters = New JSONWriterSettings(JSONLineBreak.Windows
|
JSONParameters = New JSONWriterSettings(JSONLineBreak.Windows
|
||||||
, " "
|
, " "
|
||||||
@@ -319,7 +319,7 @@ Function JSONString(Val Data, Val Escaping = "No") Export
|
|||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Function NumberToString(Val Number) Export
|
Function NumberToString(Val Number) Export
|
||||||
Return StrReplace(String(Number), Chars.NPP, "");
|
Return StrReplace(String(Number), Chars.NBSp, "");
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Function ReadJSONFile(Val Path) Export
|
Function ReadJSONFile(Val Path) Export
|
||||||
@@ -361,7 +361,7 @@ EndFunction
|
|||||||
Function UNIXTime(Val Date) Export
|
Function UNIXTime(Val Date) Export
|
||||||
|
|
||||||
OTD = New TypeDescription("Date");
|
OTD = New TypeDescription("Date");
|
||||||
Date = OTD.ConvertValue(Date);
|
Date = OTD.AdjustValue(Date);
|
||||||
|
|
||||||
UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0");
|
UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0");
|
||||||
UNIX = StrReplace(UNIX, ",", "");
|
UNIX = StrReplace(UNIX, ",", "");
|
||||||
@@ -666,7 +666,7 @@ Function ExecuteMultipartRequest(Val URL
|
|||||||
Redirection = 300;
|
Redirection = 300;
|
||||||
Error = 400;
|
Error = 400;
|
||||||
Boundary = StrReplace(String(New UUID), "-", "");
|
Boundary = StrReplace(String(New UUID), "-", "");
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
DataType = "multipart/form-data; boundary=" + Boundary;
|
DataType = "multipart/form-data; boundary=" + Boundary;
|
||||||
URLStructure = SplitURL(URL);
|
URLStructure = SplitURL(URL);
|
||||||
Server = URLStructure["Server"];
|
Server = URLStructure["Server"];
|
||||||
@@ -687,7 +687,7 @@ Function ExecuteMultipartRequest(Val URL
|
|||||||
WriteMultipartParameters(TextRecord, Boundary, Parameters);
|
WriteMultipartParameters(TextRecord, Boundary, Parameters);
|
||||||
WriteMultipartFiles(TextRecord, Boundary, ContentType, Files);
|
WriteMultipartFiles(TextRecord, Boundary, ContentType, Files);
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + "--" + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + "--" + LineSeparator);
|
||||||
TextRecord.Close();
|
TextRecord.Close();
|
||||||
|
|
||||||
Request.SetBodyFileName(RequestBody);
|
Request.SetBodyFileName(RequestBody);
|
||||||
@@ -730,7 +730,7 @@ Function ExecuteMultipartRelatedRequest(Val URL
|
|||||||
Redirection = 300;
|
Redirection = 300;
|
||||||
Error = 400;
|
Error = 400;
|
||||||
Boundary = StrReplace(String(New UUID), "-", "");
|
Boundary = StrReplace(String(New UUID), "-", "");
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
DataType = "multipart/related; boundary=" + Boundary;
|
DataType = "multipart/related; boundary=" + Boundary;
|
||||||
URLStructure = SplitURL(URL);
|
URLStructure = SplitURL(URL);
|
||||||
Server = URLStructure["Server"];
|
Server = URLStructure["Server"];
|
||||||
@@ -751,7 +751,7 @@ Function ExecuteMultipartRelatedRequest(Val URL
|
|||||||
WriteJSONMultipart(TextRecord, Boundary, JSON);
|
WriteJSONMultipart(TextRecord, Boundary, JSON);
|
||||||
WriteRelatedFiles(TextRecord, Boundary, Files);
|
WriteRelatedFiles(TextRecord, Boundary, Files);
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + "--" + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + "--" + LineSeparator);
|
||||||
TextRecord.Close();
|
TextRecord.Close();
|
||||||
|
|
||||||
AddContentLength(Request);
|
AddContentLength(Request);
|
||||||
@@ -839,7 +839,7 @@ EndProcedure
|
|||||||
|
|
||||||
Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
||||||
|
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
|
|
||||||
For Each Parameter In Parameters Do
|
For Each Parameter In Parameters Do
|
||||||
|
|
||||||
@@ -848,20 +848,20 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
|||||||
Continue;
|
Continue;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Disposition: form-data; name=""" + Parameter.Key + """");
|
TextRecord.WriteLine("Content-Disposition: form-data; name=""" + Parameter.Key + """");
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
If TypeOf(Parameter.Value) = Type("String")
|
If TypeOf(Parameter.Value) = Type("String")
|
||||||
Or TypeOf(Parameter.Value) = Type("Number") Then
|
Or TypeOf(Parameter.Value) = Type("Number") Then
|
||||||
|
|
||||||
ValueAsString = NumberToString(Parameter.Value);
|
ValueAsString = NumberToString(Parameter.Value);
|
||||||
TextRecord.WriteString(ValueAsString);
|
TextRecord.WriteLine(ValueAsString);
|
||||||
|
|
||||||
ElsIf TypeOf(Parameter.Value) = Type("Boolean") Then
|
ElsIf TypeOf(Parameter.Value) = Type("Boolean") Then
|
||||||
|
|
||||||
TextRecord.WriteString(?(Parameter.Value, "true", "false"));
|
TextRecord.WriteLine(?(Parameter.Value, "true", "false"));
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|
||||||
@@ -869,7 +869,7 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
|||||||
|
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
@@ -878,7 +878,7 @@ EndProcedure
|
|||||||
Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files)
|
Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files)
|
||||||
|
|
||||||
ContentType = TrimAll(ContentType);
|
ContentType = TrimAll(ContentType);
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
DotReplacement = "___";
|
DotReplacement = "___";
|
||||||
|
|
||||||
For Each File In Files Do
|
For Each File In Files Do
|
||||||
@@ -894,22 +894,22 @@ Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Fil
|
|||||||
DotReplacement, "."));
|
DotReplacement, "."));
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Disposition: form-data; name="""
|
TextRecord.WriteLine("Content-Disposition: form-data; name="""
|
||||||
+ SendingFileName
|
+ SendingFileName
|
||||||
+ """; filename="""
|
+ """; filename="""
|
||||||
+ FilePath
|
+ FilePath
|
||||||
+ """");
|
+ """");
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
If ValueIsFilled(ContentType) Then
|
If ValueIsFilled(ContentType) Then
|
||||||
TextRecord.WriteString("Content-Type: " + ContentType);
|
TextRecord.WriteLine("Content-Type: " + ContentType);
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
WriteBinaryData(TextRecord, File.Value);
|
WriteBinaryData(TextRecord, File.Value);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
@@ -921,18 +921,18 @@ Procedure WriteRelatedFiles(TextRecord, Val Boundary, Val Files)
|
|||||||
Return;
|
Return;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
|
|
||||||
If TypeOf(Files) = Type("Map") Then
|
If TypeOf(Files) = Type("Map") Then
|
||||||
For Each File In Files Do
|
For Each File In Files Do
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Type: " + File.Value);
|
TextRecord.WriteLine("Content-Type: " + File.Value);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
WriteBinaryData(TextRecord, File.Key);
|
WriteBinaryData(TextRecord, File.Key);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
@@ -976,15 +976,15 @@ Procedure WriteJSONMultipart(TextRecord, Val Boundary, Val JSON)
|
|||||||
Return;
|
Return;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Type: application/json; charset=UTF-8");
|
TextRecord.WriteLine("Content-Type: application/json; charset=UTF-8");
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(JSON);
|
TextRecord.WriteLine(JSON);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@@ -1107,9 +1107,9 @@ Function ReadZip(CompressedData, ErrorText = Undefined)
|
|||||||
|
|
||||||
Directory = GetTempFileName();
|
Directory = GetTempFileName();
|
||||||
ReadingZip = New ZipFileReader(CompressedData);
|
ReadingZip = New ZipFileReader(CompressedData);
|
||||||
FileName = ReadingZip.Elements[0].Name;
|
FileName = ReadingZip.Items[0].Name;
|
||||||
Try
|
Try
|
||||||
ReadingZip.Extract(ReadingZip.Elements[0], Directory, ZIPRestoreFilePathsMode.DontRestore);
|
ReadingZip.Extract(ReadingZip.Items[0], Directory, ZIPRestoreFilePathsMode.DontRestore);
|
||||||
Except
|
Except
|
||||||
// Ignore archive integrity check, just read the result
|
// Ignore archive integrity check, just read the result
|
||||||
ErrorText = DetailErrorDescription(ErrorInfo());
|
ErrorText = DetailErrorDescription(ErrorInfo());
|
||||||
|
@@ -820,8 +820,8 @@ Function GetRequestHeaders(Val Token, Val Parameters = "")
|
|||||||
|
|
||||||
If ValueIsFilled(Parameters) Then
|
If ValueIsFilled(Parameters) Then
|
||||||
|
|
||||||
JSON = OPI_Tools.JSONString(Parameters, "No");
|
JSON = OPI_Tools.JSONString(Parameters, "None");
|
||||||
JSON = StrReplace(JSON, Chars.VK + Chars.PS, "");
|
JSON = StrReplace(JSON, Chars.CR + Chars.PS, "");
|
||||||
|
|
||||||
Headers.Insert("Dropbox-API-Arg", JSON);
|
Headers.Insert("Dropbox-API-Arg", JSON);
|
||||||
|
|
||||||
|
@@ -226,7 +226,7 @@ Function ExpectsThat(Value) Export
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
|
|
||||||
Module = GetCommonModule("UTest");
|
Module = GetCommonModule("ЮTest");
|
||||||
Awaiting = TypeOf(Module) = Type("CommonModule");
|
Awaiting = TypeOf(Module) = Type("CommonModule");
|
||||||
Return Module.ExpectsThat(Value);
|
Return Module.ExpectsThat(Value);
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ EndFunction
|
|||||||
|
|
||||||
Function FormYAXTests() Export
|
Function FormYAXTests() Export
|
||||||
|
|
||||||
Module = GetCommonModule("UTTests");
|
Module = GetCommonModule("ЮТTests");
|
||||||
Sections = GetTestingSectionMapping();
|
Sections = GetTestingSectionMapping();
|
||||||
TestTable = GetTestTable();
|
TestTable = GetTestTable();
|
||||||
|
|
||||||
@@ -246,12 +246,12 @@ Function FormYAXTests() Export
|
|||||||
|
|
||||||
CurrentSection = Section.Key;
|
CurrentSection = Section.Key;
|
||||||
Filter = New Structure("Section", CurrentSection);
|
Filter = New Structure("Section", CurrentSection);
|
||||||
SectionTests = TestTable.FindLines(Filter);
|
SectionTests = TestTable.FindRows(Filter);
|
||||||
|
|
||||||
Set = Module.AddTestSet(CurrentSection);
|
Set = Module.AddTestоinыйSet(CurrentSection);
|
||||||
|
|
||||||
For Each Test In SectionTests Do
|
For Each Test In SectionTests Do
|
||||||
Set.AddServerTest(Test.Method, Test.Synonym);
|
Set.AddServerныйTest(Test.Method, Test.Synonym);
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
// For YAxUnit
|
// For YAxUnit
|
||||||
|
|
||||||
Procedure ExecutableScripts() Export
|
Procedure AndwithполняеымыеСцеtoрии() Export
|
||||||
|
|
||||||
OPI_TestDataRetrieval.FormYAXTests();
|
OPI_TestDataRetrieval.FormYAXTests();
|
||||||
|
|
||||||
@@ -490,7 +490,7 @@ Procedure VKAPI_GetPostStatistics() Export
|
|||||||
|
|
||||||
// !OInt OPI_TestDataRetrieval.WriteLog(Result, "GetPostStatistics");
|
// !OInt OPI_TestDataRetrieval.WriteLog(Result, "GetPostStatistics");
|
||||||
|
|
||||||
OPI_TestDataRetrieval.ExpectsThat(Result).HasType("Array").HasLength(2);
|
OPI_TestDataRetrieval.ExpectsThat(Result).HasType("Array").AndмеетДлину(2);
|
||||||
|
|
||||||
OPI_Tools.Pause(5);
|
OPI_Tools.Pause(5);
|
||||||
|
|
||||||
@@ -826,7 +826,7 @@ Procedure VKAPI_CreateProductWithProperties() Export
|
|||||||
OPI_Tools.Pause(5);
|
OPI_Tools.Pause(5);
|
||||||
|
|
||||||
OPI_TestDataRetrieval.ExpectsThat(Result).HasType(TypeMatch);
|
OPI_TestDataRetrieval.ExpectsThat(Result).HasType(TypeMatch);
|
||||||
OPI_TestDataRetrieval.ExpectsThat(Result[Response]["items"]).HasType("Array").HasLength(2);
|
OPI_TestDataRetrieval.ExpectsThat(Result[Response]["items"]).HasType("Array").AndмеетДлину(2);
|
||||||
|
|
||||||
Result = OPI_VK.GroupProducts(ProductsArray, , Parameters);
|
Result = OPI_VK.GroupProducts(ProductsArray, , Parameters);
|
||||||
|
|
||||||
|
@@ -293,7 +293,7 @@ Function JsonToStructure(Val Text) Export
|
|||||||
|
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Function JSONString(Val Data, Val Escaping = "No") Export
|
Function JSONString(Val Data, Val Escaping = "None") Export
|
||||||
|
|
||||||
JSONParameters = New JSONWriterSettings(JSONLineBreak.Windows
|
JSONParameters = New JSONWriterSettings(JSONLineBreak.Windows
|
||||||
, " "
|
, " "
|
||||||
@@ -319,7 +319,7 @@ Function JSONString(Val Data, Val Escaping = "No") Export
|
|||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Function NumberToString(Val Number) Export
|
Function NumberToString(Val Number) Export
|
||||||
Return StrReplace(String(Number), Chars.NPP, "");
|
Return StrReplace(String(Number), Chars.NBSp, "");
|
||||||
EndFunction
|
EndFunction
|
||||||
|
|
||||||
Function ReadJSONFile(Val Path) Export
|
Function ReadJSONFile(Val Path) Export
|
||||||
@@ -361,7 +361,7 @@ EndFunction
|
|||||||
Function UNIXTime(Val Date) Export
|
Function UNIXTime(Val Date) Export
|
||||||
|
|
||||||
OTD = New TypeDescription("Date");
|
OTD = New TypeDescription("Date");
|
||||||
Date = OTD.ConvertValue(Date);
|
Date = OTD.AdjustValue(Date);
|
||||||
|
|
||||||
UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0");
|
UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0");
|
||||||
UNIX = StrReplace(UNIX, ",", "");
|
UNIX = StrReplace(UNIX, ",", "");
|
||||||
@@ -666,7 +666,7 @@ Function ExecuteMultipartRequest(Val URL
|
|||||||
Redirection = 300;
|
Redirection = 300;
|
||||||
Error = 400;
|
Error = 400;
|
||||||
Boundary = StrReplace(String(New UUID), "-", "");
|
Boundary = StrReplace(String(New UUID), "-", "");
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
DataType = "multipart/form-data; boundary=" + Boundary;
|
DataType = "multipart/form-data; boundary=" + Boundary;
|
||||||
URLStructure = SplitURL(URL);
|
URLStructure = SplitURL(URL);
|
||||||
Server = URLStructure["Server"];
|
Server = URLStructure["Server"];
|
||||||
@@ -687,7 +687,7 @@ Function ExecuteMultipartRequest(Val URL
|
|||||||
WriteMultipartParameters(TextRecord, Boundary, Parameters);
|
WriteMultipartParameters(TextRecord, Boundary, Parameters);
|
||||||
WriteMultipartFiles(TextRecord, Boundary, ContentType, Files);
|
WriteMultipartFiles(TextRecord, Boundary, ContentType, Files);
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + "--" + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + "--" + LineSeparator);
|
||||||
TextRecord.Close();
|
TextRecord.Close();
|
||||||
|
|
||||||
Request.SetBodyFileName(RequestBody);
|
Request.SetBodyFileName(RequestBody);
|
||||||
@@ -730,7 +730,7 @@ Function ExecuteMultipartRelatedRequest(Val URL
|
|||||||
Redirection = 300;
|
Redirection = 300;
|
||||||
Error = 400;
|
Error = 400;
|
||||||
Boundary = StrReplace(String(New UUID), "-", "");
|
Boundary = StrReplace(String(New UUID), "-", "");
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
DataType = "multipart/related; boundary=" + Boundary;
|
DataType = "multipart/related; boundary=" + Boundary;
|
||||||
URLStructure = SplitURL(URL);
|
URLStructure = SplitURL(URL);
|
||||||
Server = URLStructure["Server"];
|
Server = URLStructure["Server"];
|
||||||
@@ -751,7 +751,7 @@ Function ExecuteMultipartRelatedRequest(Val URL
|
|||||||
WriteJSONMultipart(TextRecord, Boundary, JSON);
|
WriteJSONMultipart(TextRecord, Boundary, JSON);
|
||||||
WriteRelatedFiles(TextRecord, Boundary, Files);
|
WriteRelatedFiles(TextRecord, Boundary, Files);
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + "--" + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + "--" + LineSeparator);
|
||||||
TextRecord.Close();
|
TextRecord.Close();
|
||||||
|
|
||||||
AddContentLength(Request);
|
AddContentLength(Request);
|
||||||
@@ -839,7 +839,7 @@ EndProcedure
|
|||||||
|
|
||||||
Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
||||||
|
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
|
|
||||||
For Each Parameter In Parameters Do
|
For Each Parameter In Parameters Do
|
||||||
|
|
||||||
@@ -848,20 +848,20 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
|||||||
Continue;
|
Continue;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Disposition: form-data; name=""" + Parameter.Key + """");
|
TextRecord.WriteLine("Content-Disposition: form-data; name=""" + Parameter.Key + """");
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
If TypeOf(Parameter.Value) = Type("String")
|
If TypeOf(Parameter.Value) = Type("String")
|
||||||
Or TypeOf(Parameter.Value) = Type("Number") Then
|
Or TypeOf(Parameter.Value) = Type("Number") Then
|
||||||
|
|
||||||
ValueAsString = NumberToString(Parameter.Value);
|
ValueAsString = NumberToString(Parameter.Value);
|
||||||
TextRecord.WriteString(ValueAsString);
|
TextRecord.WriteLine(ValueAsString);
|
||||||
|
|
||||||
ElsIf TypeOf(Parameter.Value) = Type("Boolean") Then
|
ElsIf TypeOf(Parameter.Value) = Type("Boolean") Then
|
||||||
|
|
||||||
TextRecord.WriteString(?(Parameter.Value, "true", "false"));
|
TextRecord.WriteLine(?(Parameter.Value, "true", "false"));
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|
||||||
@@ -869,7 +869,7 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
|||||||
|
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
@@ -878,7 +878,7 @@ EndProcedure
|
|||||||
Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files)
|
Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files)
|
||||||
|
|
||||||
ContentType = TrimAll(ContentType);
|
ContentType = TrimAll(ContentType);
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
DotReplacement = "___";
|
DotReplacement = "___";
|
||||||
|
|
||||||
For Each File In Files Do
|
For Each File In Files Do
|
||||||
@@ -894,22 +894,22 @@ Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Fil
|
|||||||
DotReplacement, "."));
|
DotReplacement, "."));
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Disposition: form-data; name="""
|
TextRecord.WriteLine("Content-Disposition: form-data; name="""
|
||||||
+ SendingFileName
|
+ SendingFileName
|
||||||
+ """; filename="""
|
+ """; filename="""
|
||||||
+ FilePath
|
+ FilePath
|
||||||
+ """");
|
+ """");
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
If ValueIsFilled(ContentType) Then
|
If ValueIsFilled(ContentType) Then
|
||||||
TextRecord.WriteString("Content-Type: " + ContentType);
|
TextRecord.WriteLine("Content-Type: " + ContentType);
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
WriteBinaryData(TextRecord, File.Value);
|
WriteBinaryData(TextRecord, File.Value);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
@@ -921,18 +921,18 @@ Procedure WriteRelatedFiles(TextRecord, Val Boundary, Val Files)
|
|||||||
Return;
|
Return;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
|
|
||||||
If TypeOf(Files) = Type("Map") Then
|
If TypeOf(Files) = Type("Map") Then
|
||||||
For Each File In Files Do
|
For Each File In Files Do
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Type: " + File.Value);
|
TextRecord.WriteLine("Content-Type: " + File.Value);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
WriteBinaryData(TextRecord, File.Key);
|
WriteBinaryData(TextRecord, File.Key);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndDo;
|
EndDo;
|
||||||
|
|
||||||
@@ -976,15 +976,15 @@ Procedure WriteJSONMultipart(TextRecord, Val Boundary, Val JSON)
|
|||||||
Return;
|
Return;
|
||||||
EndIf;
|
EndIf;
|
||||||
|
|
||||||
LineSeparator = Chars.VK + Chars.PS;
|
LineSeparator = Chars.CR + Chars.PS;
|
||||||
|
|
||||||
TextRecord.WriteString("--" + boundary + LineSeparator);
|
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||||
TextRecord.WriteString("Content-Type: application/json; charset=UTF-8");
|
TextRecord.WriteLine("Content-Type: application/json; charset=UTF-8");
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(JSON);
|
TextRecord.WriteLine(JSON);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
TextRecord.WriteString(LineSeparator);
|
TextRecord.WriteLine(LineSeparator);
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@@ -1107,9 +1107,9 @@ Function ReadZip(CompressedData, ErrorText = Undefined)
|
|||||||
|
|
||||||
Directory = GetTempFileName();
|
Directory = GetTempFileName();
|
||||||
ReadingZip = New ZipFileReader(CompressedData);
|
ReadingZip = New ZipFileReader(CompressedData);
|
||||||
FileName = ReadingZip.Elements[0].Name;
|
FileName = ReadingZip.Items[0].Name;
|
||||||
Try
|
Try
|
||||||
ReadingZip.Extract(ReadingZip.Elements[0], Directory, ZIPRestoreFilePathsMode.DontRestore);
|
ReadingZip.Extract(ReadingZip.Items[0], Directory, ZIPRestoreFilePathsMode.DontRestore);
|
||||||
Except
|
Except
|
||||||
// Ignore archive integrity check, just read the result
|
// Ignore archive integrity check, just read the result
|
||||||
ErrorText = DetailErrorDescription(ErrorInfo());
|
ErrorText = DetailErrorDescription(ErrorInfo());
|
||||||
|
@@ -290,7 +290,7 @@ Procedure GetDate(Value) Export
|
|||||||
|
|
||||||
Except
|
Except
|
||||||
OOD = New TypeDescription(Date);
|
OOD = New TypeDescription(Date);
|
||||||
Value = OOD.ConvertValue(Value);
|
Value = OOD.AdjustValue(Value);
|
||||||
EndTry;
|
EndTry;
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
@@ -298,7 +298,7 @@ EndProcedure
|
|||||||
Procedure GetNumber(Value) Export
|
Procedure GetNumber(Value) Export
|
||||||
|
|
||||||
TypeDescription = New TypeDescription("Number");
|
TypeDescription = New TypeDescription("Number");
|
||||||
Value = TypeDescription.ConvertValue(Value);
|
Value = TypeDescription.AdjustValue(Value);
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user