func TestUpdateFeed(t *testing.T) { log.SetLevel(log.DebugLevel) log.SetFormatter(&log.TextFormatter{DisableColors: true}) var repo FakeRepo v := viper.New() v.Set("HTTP_DIR", "/var/www/m3m3/") config := utils.NewCustomAppConfig(v) sysutils := utils.NewSysUtils(config) manager := utils.NewManager(sysutils) cr := newCrawlerNoSources(manager, repo, sysutils) u := "http://feeds.feedburner.com/DamnLOL" feed := &Feed{url: u, name: "test feed"} c := make(chan int) go cr.update(feed, 10, c) updated := <-c if updated < 4 { t.Error("Too few images for this feed") } }
func main() { log.SetLevel(log.InfoLevel) log.SetFormatter(&log.TextFormatter{DisableColors: true}) config := utils.NewAppConfig() sysutils := utils.NewSysUtils(config) emailutils := utils.NewEmailUtils(config) db := persistence.NewMySqlHandler(config, sysutils) repo := persistence.NewRepo(db) manager := utils.NewManager(sysutils) crawler := crawler.NewCrawler(manager, repo, sysutils) crawler.Start() interactor := core.NewItemInteractor(repo, manager, sysutils) webhandler := web.NewWebHandler(interactor, repo, config, emailutils, sysutils) webhandler.StartServer() select {} }