mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
reorganise LMV_ExtendedTests
- moved headless login function to a generic file.
This commit is contained in:
committed by
alexiscatnip
parent
c09a692a55
commit
5cbb3c4746
@@ -0,0 +1,63 @@
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using Tests;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Raindrop.Tests.LMV_ExtendedTests
|
||||
{
|
||||
public class Helpers
|
||||
{
|
||||
|
||||
// Perform login, using the LMV library only.
|
||||
public static void LoginHeadless(
|
||||
RaindropInstance instance,
|
||||
int userIdx = 0,
|
||||
string startLocation = "Hooper")
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
/* hack: I added this,
|
||||
* to prevent the library from throwing the runtime exception :
|
||||
*
|
||||
* Unhandled log message: '[Error] 22:34:22 [ERROR] - <TanukiDEV
|
||||
* Resident>: Setting server side baking failed'. Use
|
||||
* UnityEngine.TestTools.LogAssert.Expect */
|
||||
instance.Client.Settings.SEND_AGENT_APPEARANCE = false;
|
||||
|
||||
var fullUsername = Secrets.GridUsers[userIdx];
|
||||
var password = Secrets.GridPass[userIdx];
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(fullUsername),
|
||||
"LMVTestAgentUsername is empty. " +
|
||||
"Live NetworkTests cannot be performed.");
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(password),
|
||||
"LMVTestAgentPassword is empty. " +
|
||||
"Live NetworkTests cannot be performed.");
|
||||
var username = fullUsername.Split(' ');
|
||||
|
||||
// Connect to the grid
|
||||
string startLoc =
|
||||
NetworkManager.StartLocation(startLocation, 179, 18, 32);
|
||||
Debug.Log($"Logging in " +
|
||||
$"User: {fullUsername}, " +
|
||||
$"Loc: {startLoc}");
|
||||
bool loginSuccessful = instance.Client.Network.Login(
|
||||
username[0],
|
||||
username[1],
|
||||
password,
|
||||
"Unit Test Framework",
|
||||
startLoc,
|
||||
"raindropcafeofficial@gmail.com");
|
||||
Assert.IsTrue(loginSuccessful,
|
||||
$"Client failed to login, reason: " +
|
||||
$"{instance.Client.Network.LoginMessage}");
|
||||
Debug.Log("Grid returned the login message: "
|
||||
+ instance.Client.Network.LoginMessage);
|
||||
|
||||
Assert.IsTrue(
|
||||
instance.Client.Network.Connected,
|
||||
"Client is not connected to the grid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 769fdebf5cda42148b14bc52affff616
|
||||
timeCreated: 1657296086
|
||||
+2
-47
@@ -12,7 +12,7 @@ using OpenMetaverse.Http;
|
||||
using Plugins.ObjectPool;
|
||||
using Tests;
|
||||
|
||||
namespace Raindrop.Tests
|
||||
namespace Raindrop.Tests.LMV_ExtendedTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class LMVLibraryImageFetchingTests
|
||||
@@ -36,51 +36,6 @@ namespace Raindrop.Tests
|
||||
instance = new RaindropInstance(new GridClient());
|
||||
}
|
||||
|
||||
// Do login using the LMV library only.
|
||||
void LoginHeadless(int userIdx = 0, string startLocation = "Hooper")
|
||||
{
|
||||
/* hack: I added this,
|
||||
* to prevent the library from throwing the runtime exception :
|
||||
*
|
||||
* Unhandled log message: '[Error] 22:34:22 [ERROR] - <TanukiDEV
|
||||
* Resident>: Setting server side baking failed'. Use
|
||||
* UnityEngine.TestTools.LogAssert.Expect */
|
||||
|
||||
instance.Client.Settings.SEND_AGENT_APPEARANCE = false;
|
||||
|
||||
var fullUsername = Secrets.GridUsers[userIdx];
|
||||
var password = Secrets.GridPass[userIdx];
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(fullUsername),
|
||||
"LMVTestAgentUsername is empty. " +
|
||||
"Live NetworkTests cannot be performed.");
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(password),
|
||||
"LMVTestAgentPassword is empty. " +
|
||||
"Live NetworkTests cannot be performed.");
|
||||
var username = fullUsername.Split(' ');
|
||||
|
||||
// Connect to the grid
|
||||
string startLoc =
|
||||
NetworkManager.StartLocation(startLocation, 179, 18, 32);
|
||||
Debug.Log($"Logging in " +
|
||||
$"User: {fullUsername}, " +
|
||||
$"Loc: {startLoc}");
|
||||
bool loginSuccessful = instance.Client.Network.Login(
|
||||
username[0],
|
||||
username[1],
|
||||
password,
|
||||
"Unit Test Framework",
|
||||
startLoc,
|
||||
"raindropcafeofficial@gmail.com");
|
||||
Assert.IsTrue(loginSuccessful,
|
||||
$"Client failed to login, reason: " +
|
||||
$"{instance.Client.Network.LoginMessage}");
|
||||
Debug.Log("Grid returned the login message: "
|
||||
+ instance.Client.Network.LoginMessage);
|
||||
|
||||
Assert.IsTrue(
|
||||
instance.Client.Network.Connected,
|
||||
"Client is not connected to the grid");
|
||||
}
|
||||
|
||||
/* DownloadManager variant of 'wtf' WebRequest.
|
||||
* (Used to) Fail in unity editor, android target, net standard 2.0
|
||||
@@ -353,7 +308,7 @@ namespace Raindrop.Tests
|
||||
[Test]
|
||||
public IEnumerator LoginAndDownloadJ2P()
|
||||
{
|
||||
LoginHeadless();
|
||||
Helpers.LoginHeadless(instance, 0, "Hooper");
|
||||
|
||||
yield return new WaitForSeconds(15);
|
||||
|
||||
@@ -5,7 +5,7 @@ using OpenMetaverse;
|
||||
using OpenMetaverse.Imaging;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace Raindrop.Tests
|
||||
namespace Raindrop.Tests.LMV_ExtendedTests
|
||||
{
|
||||
[TestFixture]
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Raindrop.Tests
|
||||
var instance = new RaindropInstance(new GridClient());
|
||||
|
||||
string res_file_name = "upperbody_color.tga";
|
||||
using (Stream stream = Helpers.GetResourceStream(res_file_name, OpenMetaverse.Settings.RESOURCE_DIR))
|
||||
using (Stream stream = OpenMetaverse.Helpers.GetResourceStream(res_file_name, OpenMetaverse.Settings.RESOURCE_DIR))
|
||||
{
|
||||
//can open => passed! :)
|
||||
Assert.Pass();
|
||||
|
||||
Reference in New Issue
Block a user