Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Season Super Session Implementation #230

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// © 2023-2024 Adrian Clark
// This file is licensed to you under the MIT license.

using System.Globalization;
using System.Net;
using Aydsko.iRacingData.Constants;
using Aydsko.iRacingData.Exceptions;
Expand Down Expand Up @@ -1800,6 +1801,41 @@ public async Task ListHostedSessionsCombinedSuccessfulAsync()
});
}

[Test(TestOf = typeof(DataClient))]
public async Task GetSeasonSuperSessionStandingsSuccessfulAsync()
{
await MessageHandler.QueueResponsesAsync(nameof(GetSeasonSuperSessionStandingsSuccessfulAsync)).ConfigureAwait(false);

var response = await sut.GetSeasonSuperSessionStandingsAsync(1, 1).ConfigureAwait(false);

Assert.Multiple(() =>
{
Assert.That(response, Is.Not.Null);
Assert.That(response!.Data.Header, Is.Not.Null);
Assert.That(response!.Data.Results, Is.Not.Null.And.Not.Empty);

var header = response.Data.Header;

Assert.That(header.SeriesName, Is.EqualTo("iRacing Chili Bowl Sim-Motion Nationals"));
Assert.That(header.SeasonName, Is.EqualTo("2023 iRacing Chili Bowl Sim-Motion Nationals"));
Assert.That(header.LastUpdated, Is.EqualTo(DateTimeOffset.ParseExact("2024-10-19T04:12:41.7826237Z", "yyyy-MM-ddTHH:mm:ss.fffffffZ", CultureInfo.InvariantCulture)));

var results = response.Data.Results;

Assert.That(results, Has.Length.EqualTo(header.ChunkInfo.Rows));

var exampleResult = results.SingleOrDefault(r => r.Rank == 10);
Assert.That(exampleResult, Is.Not.Null);
Assert.That(exampleResult!.CustomerId, Is.EqualTo(511237));
Assert.That(exampleResult.DisplayName, Is.EqualTo("Colt Currie"));

Assert.That(response.RateLimitRemaining, Is.EqualTo(239));
Assert.That(response.TotalRateLimit, Is.EqualTo(240));
Assert.That(response.RateLimitReset, Is.EqualTo(new DateTimeOffset(2024, 10, 19, 04, 13, 41, TimeSpan.Zero)));
Assert.That(response.DataExpires, Is.Null);
});
}

protected override void Dispose(bool disposing)
{
if (disposing)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"statusCode": 200,
"headers": {
"Connection": "keep-alive",
"Date": "Sat, 19 Oct 2024 04:12:41 GMT",
"ETag": "W/\u002221d-PyoG9skJQ1c73S6dN399q1vPRiQ\u0022",
"X-iRacing-Env": "members",
"X-iRacing-Id": "beae1c25-5e91-4c15-b72d-d0eaba5bec03",
"X-iRacing-ServiceName": "data-server",
"X-iRacing-ServiceVersion": "2.0.2",
"Content-Security-Policy": "default-src \u0027self\u0027;base-uri \u0027self\u0027;font-src \u0027self\u0027 https: data:;form-action \u0027self\u0027;frame-ancestors \u0027self\u0027;img-src \u0027self\u0027 data:;object-src \u0027none\u0027;script-src \u0027self\u0027;script-src-attr \u0027none\u0027;style-src \u0027self\u0027 https: \u0027unsafe-inline\u0027;upgrade-insecure-requests",
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Resource-Policy": "same-origin",
"Origin-Agent-Cluster": "?1",
"Referrer-Policy": "no-referrer",
"Strict-Transport-Security": "max-age=15552000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-DNS-Prefetch-Control": "off",
"X-Download-Options": "noopen",
"X-Frame-Options": "SAMEORIGIN",
"X-Permitted-Cross-Domain-Policies": "none",
"X-XSS-Protection": "0",
"X-RateLimit-Limit": "240",
"X-RateLimit-Remaining": "239",
"X-RateLimit-Reset": "1729311221",
"Cache-Control": "max-age=60",
"X-Cache": "Miss from cloudfront",
"Via": "1.1 dd1d2e3b83832c7de2ffdce9535ce208.cloudfront.net (CloudFront)",
"X-Amz-Cf-Pop": "BNE50-P2",
"X-Amz-Cf-Id": "4knToaeZBjeDQHDvz1LPAG3ozAhkJpdqo2ajRH7d72HwkI_ee1GmyQ=="
},
"content": {
"link": "https://scorpio-assets.s3.us-east-1.amazonaws.com/production/data-server/cache/data-services/stats/season_supersession_standings/3bbbcdbe-7e21-4946-9878-ad307cb34e56?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAUO6OO4A3357USLO7%2F20241019%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241019T041241Z&X-Amz-Expires=120&X-Amz-Signature=6d7ba56091ebf8e947803657f584aa94287cc161ad7e7bf26711e21f6aff5ffe&X-Amz-SignedHeaders=host&x-id=GetObject",
"expires": "2024-10-19T04:27:41.913Z"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"statusCode": 200,
"headers": {
"x-amz-id-2": "TiC2jV7ae2oNnch/KZd21HAFFiKclPfLzHLFPBVKBQBbAm2GIBkTk6QQUsHYBwhptASJW\u002Br3ZD0=",
"x-amz-request-id": "RDWSQ5DRB50E18H9",
"Date": "Sat, 19 Oct 2024 04:13:35 GMT",
"x-amz-expiration": "expiry-date=\u0022Mon, 21 Oct 2024 00:00:00 GMT\u0022, rule-id=\u0022production data-server cache expiry\u0022",
"ETag": "\u002206d58eac6d0d7e93fa072391ddde5639\u0022",
"x-amz-server-side-encryption": "AES256",
"Cache-Control": "max-age=60",
"Accept-Ranges": "bytes",
"Server": "AmazonS3"
},
"content": {
"success": true,
"season_id": 4696,
"season_name": "2023 iRacing Chili Bowl Sim-Motion Nationals",
"season_short_name": "2023 iRacing Chili Bowl Nationals",
"series_id": 426,
"series_name": "iRacing Chili Bowl Sim-Motion Nationals",
"car_class_id": 104,
"race_week_num": -1,
"division": -1,
"club_id": -1,
"customer_rank": -1,
"chunk_info": {
"chunk_size": 500,
"num_chunks": 1,
"rows": 115,
"base_download_url": "https://scorpio-assets.s3.amazonaws.com/members/messaging-services/long_lived/standings/season-ss/season/4696/104/all/",
"chunk_file_names": [
"e189cc1411896d644163520d11128bbf24e11b87835a5f97349a9899dce3b1c5.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241019T041241Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIAUO6OO4A3357USLO7%2F20241019%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=b1f9c6f11185537e28e885d80dab87d0dc15622ab2ac36e9d795cc91f1863bdc"
]
},
"last_updated": "2024-10-19T04:12:41.782623786Z",
"csv_url": "https://scorpio-assets.s3.amazonaws.com/members/messaging-services/long_lived/standings/season-ss/season/4696/104/all/export.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20241019T041241Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=AKIAUO6OO4A3357USLO7%2F20241019%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=8af2549b393869b39bf0500633045c269653a3d69477ff1ebd6c32867356a438"
}
}
Loading
Loading