mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-16 10:28:29 -07:00
adb422fedf
+ config: "filters_update_interval" * add /control/filtering_info * remove /control/filtering/enable * remove /control/filtering/disable * add /control/filtering_config * remove /control/filtering/status * add /control/filtering/set_url * remove /control/filtering/enable_url * remove /control/filtering/disable_url
38 lines
559 B
Go
38 lines
559 B
Go
package home
|
|
|
|
import (
|
|
"net/http"
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFilters(t *testing.T) {
|
|
config.client = &http.Client{
|
|
Timeout: time.Minute * 5,
|
|
}
|
|
|
|
f := filter{
|
|
URL: "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt",
|
|
}
|
|
|
|
// download
|
|
ok, err := f.update()
|
|
assert.True(t, ok && err == nil)
|
|
|
|
// refresh
|
|
ok, err = f.update()
|
|
assert.True(t, !ok && err == nil)
|
|
|
|
err = f.save()
|
|
assert.True(t, err == nil)
|
|
|
|
err = f.load()
|
|
assert.True(t, err == nil)
|
|
|
|
f.unload()
|
|
os.Remove(f.Path())
|
|
}
|