Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mukunku committed May 30, 2023
1 parent f4826dd commit 8bba363
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ParquetViewer.Tests/TestAmplitudeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public TestAmplitudeEvent(string dummyApiKey) : base(EVENT_TYPE)
public void SwapHttpClientHandler(HttpMessageHandler mockHandler)
{
HttpMessageHandler = mockHandler;
BypassConsentRequirement = true;
}
}
}
3 changes: 2 additions & 1 deletion src/ParquetViewer/Analytics/AmplitudeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public abstract class AmplitudeEvent
private static readonly int _systemRAM = (int)(GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 1048576.0 /*magic number*/);

protected HttpMessageHandler HttpMessageHandler { get; set; } = new HttpClientHandler();
protected bool BypassConsentRequirement { get; set; }

[JsonIgnore]
public string DeviceId => AppSettings.AnalyticsDeviceId.ToString();
Expand Down Expand Up @@ -48,7 +49,7 @@ public async Task<bool> Record()
{
try
{
if (AMPLITUDE_API_KEY.Length == 0 || !AppSettings.AnalyticsDataGatheringConsent)
if (!BypassConsentRequirement && (AMPLITUDE_API_KEY.Length == 0 || !AppSettings.AnalyticsDataGatheringConsent))
return false;

var request = new
Expand Down

0 comments on commit 8bba363

Please sign in to comment.