refactor(mlablocate*): use internal testing (#382)

This is not an external package and it's fine to just use internal testing.

It reduces the complexity a little bit.
This commit is contained in:
Simone Basso 2021-06-15 18:11:47 +02:00 committed by GitHub
commit 34062cb177
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 58 deletions

View file

@ -1,4 +1,4 @@
package mlablocate_test
package mlablocate
import (
"context"
@ -9,11 +9,10 @@ import (
"testing"
"github.com/apex/log"
"github.com/ooni/probe-cli/v3/internal/engine/internal/mlablocate"
)
func TestWithoutProxy(t *testing.T) {
client := mlablocate.NewClient(
client := NewClient(
http.DefaultClient,
log.Log,
"miniooni/0.1.0-dev",
@ -28,7 +27,7 @@ func TestWithoutProxy(t *testing.T) {
}
func Test404Response(t *testing.T) {
client := mlablocate.NewClient(
client := NewClient(
http.DefaultClient,
log.Log,
"miniooni/0.1.0-dev",
@ -43,7 +42,7 @@ func Test404Response(t *testing.T) {
}
func TestNewRequestFailure(t *testing.T) {
client := mlablocate.NewClient(
client := NewClient(
http.DefaultClient,
log.Log,
"miniooni/0.1.0-dev",
@ -59,7 +58,7 @@ func TestNewRequestFailure(t *testing.T) {
}
func TestHTTPClientDoFailure(t *testing.T) {
client := mlablocate.NewClient(
client := NewClient(
http.DefaultClient,
log.Log,
"miniooni/0.1.0-dev",
@ -86,7 +85,7 @@ func (txp *roundTripFails) RoundTrip(*http.Request) (*http.Response, error) {
}
func TestCannotReadBody(t *testing.T) {
client := mlablocate.NewClient(
client := NewClient(
http.DefaultClient,
log.Log,
"miniooni/0.1.0-dev",
@ -128,7 +127,7 @@ func (b *readingBodyFailsBody) Close() error {
}
func TestInvalidJSON(t *testing.T) {
client := mlablocate.NewClient(
client := NewClient(
http.DefaultClient,
log.Log,
"miniooni/0.1.0-dev",
@ -169,7 +168,7 @@ func (b *invalidJSONBody) Close() error {
}
func TestEmptyFQDN(t *testing.T) {
client := mlablocate.NewClient(
client := NewClient(
http.DefaultClient,
log.Log,
"miniooni/0.1.0-dev",