Skip to content

Commit

Permalink
[FIX] - Send POST-Request to click Update before retrieving results.
Browse files Browse the repository at this point in the history
When the actual date is greater than the ausbildung period date, we need to click the "Aktualsieren" button
before retrieving the results so the server won't destroy our session and accept it as a valid request.
  • Loading branch information
giladreich committed Sep 6, 2018
1 parent 3b38b70 commit 84f0d62
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/IHK.ResultsNotifier/IHK.ResultsNotifier.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ProjectGuid>{B717B701-620D-4714-8E9B-8963BF433CDE}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>IHK.ResultsNotifier</RootNamespace>
<AssemblyName>IHK-ResultsNotifier-v2.0.2</AssemblyName>
<AssemblyName>IHK-ResultsNotifier-v2.0.3</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down
4 changes: 2 additions & 2 deletions src/IHK.ResultsNotifier/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]
[assembly: AssemblyVersion("2.0.3.0")]
[assembly: AssemblyFileVersion("2.0.3.0")]
10 changes: 10 additions & 0 deletions src/IHK.ResultsNotifier/Utils/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public async Task<string> GetExamResultsDocument()
if (!IsAuthenticated)
throw new AuthenticationException("Cannot get exam results before the user is authenticated.");

// Triggers the Aktualisieren button just in case the date is greater than the actual ausbildung period.
HttpContent payload = new FormUrlEncodedContent(
new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("azubvtrg", "1"),
new KeyValuePair<string, string>("abbruch", "")
}
);
HttpResponseMessage btnResp = await SendRequestAsync(() => client.PostAsync(EXAMS_PAGE, payload));

HttpResponseMessage resultsResp = await SendRequestAsync(() => client.GetAsync(EXAMS_RESULTS_PAGE));

return await resultsResp.Content.ReadAsStringAsync();
Expand Down

0 comments on commit 84f0d62

Please sign in to comment.