Skip to content

Commit

Permalink
Test update on DeleteSObject
Browse files Browse the repository at this point in the history
  • Loading branch information
jannejjj committed Aug 15, 2024
1 parent 8a9799d commit fced130
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/DeleteSObject_build_and_test_on_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ jobs:
env_var_name_2: Salesforce_Password
env_var_name_3: Salesforce_Security_Token
env_var_name_4: Salesforce_ClientID
env_var_name_5: Salesforce_Username
secrets:
badge_service_api_key: ${{ secrets.BADGE_SERVICE_API_KEY }}
env_var_value_1: ${{ secrets.SALESFORCE_CLIENT_SECRET }}
env_var_value_2: ${{ secrets.SALESFORCE_PASSWORD }}
env_var_value_3: ${{ secrets.SALESFORCE_SECURITY_TOKEN }}
env_var_value_4: ${{ secrets.SALESFORCE_CLIENTID }}
env_var_value_5: ${{ secrets.SALESFORCE_USERNAME }}
2 changes: 2 additions & 0 deletions .github/workflows/DeleteSObject_build_and_test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
env_var_name_2: Salesforce_Password
env_var_name_3: Salesforce_Security_Token
env_var_name_4: Salesforce_ClientID
env_var_name_5: Salesforce_Username
secrets:
badge_service_api_key: ${{ secrets.BADGE_SERVICE_API_KEY }}
test_feed_api_key: ${{ secrets.TASKS_TEST_FEED_API_KEY }}
env_var_value_1: ${{ secrets.SALESFORCE_CLIENT_SECRET }}
env_var_value_2: ${{ secrets.SALESFORCE_PASSWORD }}
env_var_value_3: ${{ secrets.SALESFORCE_SECURITY_TOKEN }}
env_var_value_4: ${{ secrets.SALESFORCE_CLIENTID }}
env_var_value_5: ${{ secrets.SALESFORCE_USERNAME }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dotenv.net" Version="3.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
<PackageReference Include="nunit" Version="3.12.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Frends.Salesforce.DeleteSObject.Definitions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using dotenv.net;
using RestSharp;
using JsonSerializer = System.Text.Json.JsonSerializer;

Expand All @@ -18,9 +20,9 @@ public class UnitTests
private readonly string _password = Environment.GetEnvironmentVariable("Salesforce_Password");
private readonly string _securityToken = Environment.GetEnvironmentVariable("Salesforce_Security_Token");
private readonly string _clientID = Environment.GetEnvironmentVariable("Salesforce_ClientID");
private readonly string _username = Environment.GetEnvironmentVariable("Salesforce_Username");

private readonly string _domain = @"https://hiqfinlandoy2-dev-ed.my.salesforce.com";
private readonly string _username = "testuser@test.fi";
private readonly string _domain = @"https://frends2-dev-ed.develop.my.salesforce.com";
private readonly string _authurl = @"https://login.salesforce.com/services/oauth2/token";

private readonly CancellationToken _cancellationToken = new();
Expand All @@ -29,6 +31,17 @@ public class UnitTests

readonly string _name = "Test" + DateTime.Now.Year + "" + DateTime.Now.Month + "" + DateTime.Now.Day + "" + DateTime.Now.Hour + "" + DateTime.Now.Minute + "" + DateTime.Now.Millisecond;

[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
// load envs
var root = Directory.GetCurrentDirectory();
var projDir = Directory.GetParent(root)?.Parent?.Parent?.FullName;
DotEnv.Load(
options: new DotEnvOptions(
envFilePaths: new[] { $"{projDir}{Path.DirectorySeparatorChar}.env.local" }));
}

[TestInitialize]
public async Task TestInitialize()
{
Expand Down

0 comments on commit fced130

Please sign in to comment.