mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-25 22:45:46 +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/http"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -22,21 +21,6 @@ func TestMain(m *testing.M) {
|
||||||
aghtest.DiscardLogOutput(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) {
|
func TestNewSessionToken(t *testing.T) {
|
||||||
// Successful case.
|
// Successful case.
|
||||||
token, err := newSessionToken()
|
token, err := newSessionToken()
|
||||||
|
@ -57,7 +41,7 @@ func TestNewSessionToken(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuth(t *testing.T) {
|
func TestAuth(t *testing.T) {
|
||||||
dir := prepareTestDir(t)
|
dir := t.TempDir()
|
||||||
fn := filepath.Join(dir, "sessions.db")
|
fn := filepath.Join(dir, "sessions.db")
|
||||||
|
|
||||||
users := []User{{
|
users := []User{{
|
||||||
|
@ -132,7 +116,7 @@ func (w *testResponseWriter) WriteHeader(statusCode int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthHTTP(t *testing.T) {
|
func TestAuthHTTP(t *testing.T) {
|
||||||
dir := prepareTestDir(t)
|
dir := t.TempDir()
|
||||||
fn := filepath.Join(dir, "sessions.db")
|
fn := filepath.Join(dir, "sessions.db")
|
||||||
|
|
||||||
users := []User{
|
users := []User{
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAuthGL(t *testing.T) {
|
func TestAuthGL(t *testing.T) {
|
||||||
dir := prepareTestDir(t)
|
dir := t.TempDir()
|
||||||
|
|
||||||
GLMode = true
|
GLMode = true
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
|
|
|
@ -43,7 +43,7 @@ func testStartFilterListener(t *testing.T) net.Listener {
|
||||||
|
|
||||||
func TestFilters(t *testing.T) {
|
func TestFilters(t *testing.T) {
|
||||||
l := testStartFilterListener(t)
|
l := testStartFilterListener(t)
|
||||||
dir := prepareTestDir(t)
|
dir := t.TempDir()
|
||||||
|
|
||||||
Context = homeContext{
|
Context = homeContext{
|
||||||
workDir: dir,
|
workDir: dir,
|
||||||
|
|
|
@ -114,7 +114,7 @@ func TestHome(t *testing.T) {
|
||||||
// Init new context
|
// Init new context
|
||||||
Context = homeContext{}
|
Context = homeContext{}
|
||||||
|
|
||||||
dir := prepareTestDir(t)
|
dir := t.TempDir()
|
||||||
fn := filepath.Join(dir, "AdGuardHome.yaml")
|
fn := filepath.Join(dir, "AdGuardHome.yaml")
|
||||||
|
|
||||||
// Prepare the test config
|
// Prepare the test config
|
||||||
|
|
Loading…
Reference in a new issue