Skip to content

Commit

Permalink
Created passivetotal_test.go unit test file for PassiveTotal source
Browse files Browse the repository at this point in the history
  • Loading branch information
VltraHeaven committed Jul 31, 2019
1 parent 59eb2d5 commit 75e2f64
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions services/sources/passivetotal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package sources

import (
"testing"

"github.com/OWASP/Amass/config"
"github.com/OWASP/Amass/requests"
"github.com/OWASP/Amass/resolvers"
)

func TestPassiveTotal(t *testing.T) {
if *networkTest == false || *configPath == "" {
return
}

cfg := setupConfig(domainTest)

API := new(config.APIKey)
API = cfg.GetAPIKey("passivetotal")

if API == nil || API.Username == "" || API.Key == "" {
t.Errorf("API key data was not provided")
return
}

bus, out := setupEventBus(requests.NewNameTopic)
defer bus.Stop()

pool := resolvers.NewResolverPool(nil)
defer pool.Stop()

srv := NewPassiveTotal(cfg, bus, pool)

result := testService(srv, out)
if result < expectedTest {
t.Errorf("Found %d names, expected at least %d instead", result, expectedTest)
}
}

0 comments on commit 75e2f64

Please sign in to comment.