Beispiel #1
0
        public void ExtractTokenThrowsTokenExtractionFailedException()
        {
            var configuration = Program.BuildServiceProvider().GetService <UdemyRegexConfigurationSection>();
            var content       = "no csrf token available";

            var tokenExtractor = new CsrfTokenExtractor(configuration);

            Assert.ThrowsException <TokenExtractionFailedException>(() => tokenExtractor.GetToken(content));
        }
Beispiel #2
0
        public async Task CanExtractTokenFromOrganizationUdemy()
        {
            var configuration = Program.BuildServiceProvider().GetService <UdemyRegexConfigurationSection>();
            var fileContent   = await File.ReadAllTextAsync(UdemyOrganizationLoginPageFilename);

            var tokenExtractor = new CsrfTokenExtractor(configuration);
            var token          = tokenExtractor.GetToken(fileContent);

            Assert.AreEqual("cgz3NkDfFyolSajU3GB5XZfhaVIWYYYt", token);
        }
Beispiel #3
0
        public async Task CanExtractTokenFromPersonalUdemy()
        {
            var configuration = Program.BuildServiceProvider().GetService <UdemyRegexConfigurationSection>();
            var fileContent   = await File.ReadAllTextAsync(UdemyPersonalLoginPageFilename);

            var tokenExtractor = new CsrfTokenExtractor(configuration);
            var token          = tokenExtractor.GetToken(fileContent);

            Assert.AreEqual("CiwL3eQE4xV8FynVCJw4XwYxwGzn4Ukr", token);
        }