Skip to content

Commit

Permalink
update testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
zlzforever committed Nov 13, 2018
1 parent 4890d7a commit 0e1a847
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ services:
- mysql
- redis-server

before_script:
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('1qazZAQ!') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root

before_install:
- chmod a+x ./runtests.sh

Expand Down
2 changes: 1 addition & 1 deletion src/DotnetSpider.Core.Test/SpiderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void IdentityLengthLimit()
}
catch (Exception exception)
{
Assert.Equal($"Length of identity should less than {Env.IdentityMaxLength}.", exception.Message);
Assert.Equal($"Length of identity should less than {Env.IdentityMaxLength}", exception.Message);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected virtual IDbConnection CreateDbConnection()
[Fact(DisplayName = "DataTypes")]
public virtual void DataTypes()
{
using (MySqlConnection conn = new MySqlConnection("Database='mysql';Data Source=127.0.0.1;User ID=root;Password=;Port=3306;SslMode=None;"))
using (MySqlConnection conn = new MySqlConnection("Database='mysql';Data Source=127.0.0.1;User ID=root;Password=1qazZAQ!;Port=3306;SslMode=None;"))
{
try
{
Expand All @@ -53,7 +53,7 @@ public virtual void DataTypes()
{
}

var pipeline = new MySqlEntityPipeline("Database='mysql';Data Source=localhost;User ID=root;Password=;Port=3306;SslMode=None;");
var pipeline = new MySqlEntityPipeline("Database='mysql';Data Source=localhost;User ID=root;Password=1qazZAQ!;Port=3306;SslMode=None;");
var resultItems = new ResultItems();
resultItems.Request = new Request();
resultItems["aaaa"] =
Expand Down
2 changes: 1 addition & 1 deletion src/DotnetSpider.Extension.Test/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
public abstract class TestBase
{
public virtual string DefaultConnectionString { get; } = "Database='mysql';Data Source=localhost;User ID=root;Port=3306;SslMode=None;";
public virtual string DefaultConnectionString { get; } = "Database='mysql';Data Source=localhost;Password=1qazZAQ!;User ID=root;Port=3306;SslMode=None;";
}
}
4 changes: 2 additions & 2 deletions src/DotnetSpider.Extension.Test/app.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SystemConnection" connectionString="Database='mysql';Data Source=localhost;User ID=root;Port=3306;SslMode=None;"
<add name="SystemConnection" connectionString="Database='mysql';Data Source=localhost;Password=1qazZAQ!;User ID=root;Port=3306;SslMode=None;"
providerName="MySql.Data.MySqlClient" />
<add name="DataConnection" connectionString="Database='mysql';Data Source=localhost;User ID=root;Port=3306;SslMode=None;"
<add name="DataConnection" connectionString="Database='mysql';Data Source=localhost;User ID=root;Password=1qazZAQ!;Port=3306;SslMode=None;"
providerName="MySql.Data.MySqlClient" />

<add name="SqlServerDataConnection" connectionString="Database='mysql';Data Source=localhost;User ID=root;Port=3306;SslMode=None;"
Expand Down
4 changes: 2 additions & 2 deletions src/DotnetSpider.Extension.Test/app.service.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SystemConnection" connectionString="Database='mysql';Data Source=localhost;User ID=root;Port=3306;SslMode=None;"
<add name="SystemConnection" connectionString="Database='mysql';Data Source=localhost;Password=1qazZAQ!;User ID=root;Port=3306;SslMode=None;"
providerName="MySql.Data.MySqlClient" />
<add name="DataConnection" connectionString="Database='mysql';Data Source=localhost;User ID=root;Port=3306;SslMode=None;"
<add name="DataConnection" connectionString="Database='mysql';Data Source=localhost;Password=1qazZAQ!;User ID=root;Port=3306;SslMode=None;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<appSettings>
Expand Down
4 changes: 3 additions & 1 deletion src/DotnetSpider.Extension/Processor/ModelProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public ModelProcessor(IModel model, IModelExtractor extractor = null, params IDa
}
}

RequestExtractor = xPaths.Any(x => x == null || x == ".") ? new XPathRequestExtractor(".") : new XPathRequestExtractor(xPaths);
RequestExtractor = xPaths.Any(x => x == null || x == ".")
? new XPathRequestExtractor(".")
: (xPaths.Count == 0 ? null : new XPathRequestExtractor(xPaths));

if (dataHandlers == null) return;
foreach (var dataHandler in dataHandlers)
Expand Down

0 comments on commit 0e1a847

Please sign in to comment.