blob: 096b62839d51e47098c9634b128d709c155c599c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package main
import (
"net/http"
"testing"
)
func TestIsArchived(t *testing.T) {
url := "http://example.com/"
archived, status := isArchived(url)
if archived != true || status != 200 {
t.Errorf("Received %t, %d; want %t, %d", archived, status, true, 200)
}
}
func TestIsNotArchived(t *testing.T) {
url := "http://invalidurl.local/"
archived, _ := isArchived(url)
if archived == true {
t.Errorf("Received %t; want %t", archived, false)
}
}
func TestArchive200(t *testing.T) {
url := "http://example.com/"
status := archive(url)
if status != http.StatusOK {
t.Errorf("Recieved %d; want %d", status, http.StatusOK)
}
}
|