mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-16 11:52:58 +03:00
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())
|
||
|
}
|