From 00a83e49a124ab188b37786d44872f35cc6c809f Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Tue, 18 Aug 2015 14:29:18 -0700 Subject: [PATCH] Add another test --- policy/policy-data_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/policy/policy-data_test.go b/policy/policy-data_test.go index 64cbc8709..a523b6460 100644 --- a/policy/policy-data_test.go +++ b/policy/policy-data_test.go @@ -20,26 +20,30 @@ var ( Host: "b.com", Type: blacklisted, } + rC = DomainRule{ + Host: "d.c.com", + Type: blacklisted, + } ) func TestLoadAndDump(t *testing.T) { p, err := NewPolicyAuthorityDatabaseImpl(dbConnStr) test.AssertNotError(t, err, "Couldn't create PADB") - err = p.LoadRules([]DomainRule{rA, rB}) + err = p.LoadRules([]DomainRule{rA, rB, rC}) test.AssertNotError(t, err, "Couldn't load rules") r, err := p.DumpRules() test.AssertNotError(t, err, "Couldn't dump rules") - test.AssertEquals(t, len(r), 2) + test.AssertEquals(t, len(r), 3) } func TestGet(t *testing.T) { p, err := NewPolicyAuthorityDatabaseImpl(dbConnStr) test.AssertNotError(t, err, "Couldn't create PADB") - err = p.LoadRules([]DomainRule{rA, rB}) + err = p.LoadRules([]DomainRule{rA, rB, rC}) test.AssertNotError(t, err, "Couldn't load rules") err = p.CheckRules("b.com", false) @@ -61,4 +65,7 @@ func TestGet(t *testing.T) { test.AssertNotError(t, err, "Hostname should not be blacklisted") err = p.CheckRules(".b.com", false) test.AssertError(t, err, "Hostname should be blacklisted") + + err = p.CheckRules("e.d.c.com", false) + test.AssertError(t, err, "Hostname should be blacklisted") }