mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 04:55:33 +03:00
Pull request: home: rm unnecessary func
Merge in DNS/adguard-home from imp-test to master Squashed commit of the following: commit 0ef7812e32b74647b43bb1d69b569e9b102e92b3 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Apr 22 14:12:00 2021 +0300 home: rm unnecessary func
This commit is contained in:
parent
4165e0ef3a
commit
138dfaa85b
4 changed files with 5 additions and 21 deletions
|
@ -8,7 +8,6 @@ import (
|
|||
"net/http"
|
||||
"net/textproto"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -22,21 +21,6 @@ func TestMain(m *testing.M) {
|
|||
aghtest.DiscardLogOutput(m)
|
||||
}
|
||||
|
||||
func prepareTestDir(t *testing.T) string {
|
||||
t.Helper()
|
||||
|
||||
const dir = "./agh-test"
|
||||
|
||||
require.Nil(t, os.RemoveAll(dir))
|
||||
// TODO(e.burkov): Replace with testing.TempDir after updating Go
|
||||
// version to 1.16.
|
||||
require.Nil(t, os.MkdirAll(dir, 0o755))
|
||||
|
||||
t.Cleanup(func() { require.Nil(t, os.RemoveAll(dir)) })
|
||||
|
||||
return dir
|
||||
}
|
||||
|
||||
func TestNewSessionToken(t *testing.T) {
|
||||
// Successful case.
|
||||
token, err := newSessionToken()
|
||||
|
@ -57,7 +41,7 @@ func TestNewSessionToken(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAuth(t *testing.T) {
|
||||
dir := prepareTestDir(t)
|
||||
dir := t.TempDir()
|
||||
fn := filepath.Join(dir, "sessions.db")
|
||||
|
||||
users := []User{{
|
||||
|
@ -132,7 +116,7 @@ func (w *testResponseWriter) WriteHeader(statusCode int) {
|
|||
}
|
||||
|
||||
func TestAuthHTTP(t *testing.T) {
|
||||
dir := prepareTestDir(t)
|
||||
dir := t.TempDir()
|
||||
fn := filepath.Join(dir, "sessions.db")
|
||||
|
||||
users := []User{
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
func TestAuthGL(t *testing.T) {
|
||||
dir := prepareTestDir(t)
|
||||
dir := t.TempDir()
|
||||
|
||||
GLMode = true
|
||||
t.Cleanup(func() {
|
||||
|
|
|
@ -43,7 +43,7 @@ func testStartFilterListener(t *testing.T) net.Listener {
|
|||
|
||||
func TestFilters(t *testing.T) {
|
||||
l := testStartFilterListener(t)
|
||||
dir := prepareTestDir(t)
|
||||
dir := t.TempDir()
|
||||
|
||||
Context = homeContext{
|
||||
workDir: dir,
|
||||
|
|
|
@ -114,7 +114,7 @@ func TestHome(t *testing.T) {
|
|||
// Init new context
|
||||
Context = homeContext{}
|
||||
|
||||
dir := prepareTestDir(t)
|
||||
dir := t.TempDir()
|
||||
fn := filepath.Join(dir, "AdGuardHome.yaml")
|
||||
|
||||
// Prepare the test config
|
||||
|
|
Loading…
Reference in a new issue