Removed strict mocker from available update tests

This commit is contained in:
Mark McDowall 2013-02-23 10:02:04 -08:00
parent fd89435df8
commit 1202c9e6d0
1 changed files with 1 additions and 5 deletions

View File

@ -12,12 +12,10 @@ namespace NzbDrone.Common
{ {
private readonly EnvironmentProvider _environmentProvider; private readonly EnvironmentProvider _environmentProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private readonly string _userAgent;
public HttpProvider(EnvironmentProvider environmentProvider) public HttpProvider(EnvironmentProvider environmentProvider)
{ {
_environmentProvider = environmentProvider; _environmentProvider = environmentProvider;
_userAgent = String.Format("NzbDrone {0}", _environmentProvider.Version);
} }
public HttpProvider() public HttpProvider()
@ -39,7 +37,6 @@ namespace NzbDrone.Common
try try
{ {
var client = new WebClient { Credentials = identity }; var client = new WebClient { Credentials = identity };
client.Headers.Add(HttpRequestHeader.UserAgent, _userAgent);
return client.DownloadString(address); return client.DownloadString(address);
} }
catch (Exception ex) catch (Exception ex)
@ -52,7 +49,7 @@ namespace NzbDrone.Common
public virtual Stream DownloadStream(string url, NetworkCredential credential) public virtual Stream DownloadStream(string url, NetworkCredential credential)
{ {
var request = (HttpWebRequest)WebRequest.Create(url); var request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = _userAgent; request.UserAgent = String.Format("NzbDrone {0}", _environmentProvider.Version);
request.Credentials = credential; request.Credentials = credential;
var response = request.GetResponse(); var response = request.GetResponse();
@ -74,7 +71,6 @@ namespace NzbDrone.Common
var stopWatch = Stopwatch.StartNew(); var stopWatch = Stopwatch.StartNew();
var webClient = new WebClient(); var webClient = new WebClient();
webClient.Headers.Add(HttpRequestHeader.UserAgent, _userAgent);
webClient.DownloadFile(url, fileName); webClient.DownloadFile(url, fileName);
stopWatch.Stop(); stopWatch.Stop();
logger.Trace("Downloading Completed. took {0:0}s", stopWatch.Elapsed.Seconds); logger.Trace("Downloading Completed. took {0:0}s", stopWatch.Elapsed.Seconds);