public void AuthenticateWithNonExistingAccount() { ITransloadit transloadit = new Transloadit.Transloadit("non-existing-account"); IAssemblyBuilder assembly = new AssemblyBuilder(); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.AreEqual("GET_ACCOUNT_UNKNOWN_AUTH_KEY", response.Data["error"]); }
public void WrongSecretKey() { ITransloadit transloadit = new Transloadit.Transloadit("wrong-secret-key"); IAssemblyBuilder assembly = new AssemblyBuilder(); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.AreEqual("INVALID_SIGNATURE", response.Data["error"]); }
public void AuthenticateWithExistingAccount() { ITransloadit transloadit = new Transloadit.Transloadit(); IAssemblyBuilder assembly = new AssemblyBuilder(); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING"); }
public void AuthenticateWithNonExistingAccount() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new AssemblyBuilder(); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.AreEqual("GET_ACCOUNT_UNKNOWN_AUTH_KEY", (string)response.Data["error"]); }
public void WrongSecretKey() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new AssemblyBuilder(); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.AreEqual("INVALID_SIGNATURE", (string)response.Data["error"]); }
public void InvokeAssemblyWithNotifyUrl() { ITransloadit transloadit = new Transloadit.Transloadit(); IAssemblyBuilder assembly = new AssemblyBuilder(); assembly.SetNotifyURL("http://my.localhost"); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING"); }
public void NonExistingTemplate() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new AssemblyBuilder(); assembly.SetTemplateID("YOUR-NON-EXISTING-TEMPLATE-ID"); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.AreEqual("TEMPLATE_NOT_FOUND", (string)(response.Data["error"])); }
public void ExistingTemplate() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new AssemblyBuilder(); assembly.SetTemplateID("YOUR-EXISTING-TEMPLATE-ID"); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING"); }
public void NoInternetConnection() { ITransloadit transloadit = new Transloadit.Transloadit(); IAssemblyBuilder assembly = new AssemblyBuilder(); TransloaditResponse response = transloadit.InvokeAssembly(assembly); if (!response.Success && response.Data.ContainsKey("status") && (string)response.Data["status"] == "NO_RESPONSE") { Assert.Pass(); } }
public void NoInternetConnection() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new AssemblyBuilder(); TransloaditResponse response = transloadit.InvokeAssembly(assembly); if (!response.Success && response.Data.ToObject<Dictionary<string, object>>().ContainsKey("status") && (string)(response.Data["status"]) == "NO_RESPONSE") { Assert.Pass(); } }
public void InvokeAssemblyWithNotifyUrl() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new AssemblyBuilder(); IStep step = new Transloadit.Assembly.Step(); assembly.SetNotifyURL("http://my.localhost"); step.SetOption("robot", "/image/resize"); assembly.AddStep("step", step); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING"); }
public void AuthenticateWithExistingAccount() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new Transloadit.Assembly.AssemblyBuilder(); IStep step = new Transloadit.Assembly.Step(); step.SetOption("robot", "/image/resize"); assembly.AddStep("step", step); assembly.SetField("test", "200"); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING"); }
public void ResizeImageNonExistingFile() { ITransloadit transloadit = new Transloadit.Transloadit(); IAssemblyBuilder assembly = new AssemblyBuilder(); assembly.AddFile(@"test_non_existing.jpg"); IStep step = new Step(); step.SetOption("robot", "/image/resize"); step.SetOption("width", 75); step.SetOption("height", 75); step.SetOption("resize_strategy", "pad"); step.SetOption("background", "#000000"); assembly.AddStep("thumb", step); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING"); Assert.IsTrue(((System.Collections.ArrayList)(response.Data["uploads"])).Count == 0); }
public void ResizeImageNonExistingFile() { ITransloadit transloadit = new Transloadit.Transloadit("YOUR-PUBLIC-API-KEY", "YOUR-SECRET-KEY"); IAssemblyBuilder assembly = new AssemblyBuilder(); assembly.AddFile(@"test_non_existing.jpg"); IStep step = new Step(); step.SetOption("robot", "/image/resize"); step.SetOption("width", 75); step.SetOption("height", 75); step.SetOption("resize_strategy", "pad"); step.SetOption("background", "#000000"); assembly.AddStep("thumb", step); TransloaditResponse response = transloadit.InvokeAssembly(assembly); Assert.IsTrue((string)response.Data["ok"] == "ASSEMBLY_COMPLETED" || (string)response.Data["ok"] == "ASSEMBLY_EXECUTING"); Assert.IsTrue(response.Data["uploads"].ToObject<List<Dictionary<string, object>>>().Count == 0); }