This repository was archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathgithub_test.go
More file actions
59 lines (48 loc) · 1.44 KB
/
github_test.go
File metadata and controls
59 lines (48 loc) · 1.44 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2014-2015 Chadev. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "testing"
func TestValidateURL(t *testing.T) {
if !validateURL("https://github.com/chadev/Chadev_ircbot") {
t.Error("failed to validate proper URL: https://github.com/chadev/Chadev_ircbot")
}
}
func TestGetGitHubURL(t *testing.T) {
URL, err := getGitHubURL("Chadev_ircbot")
if err != nil {
t.Errorf("failed fetching GitHub repo URL: %s\n", err.Error())
}
t.Logf("returned URL: %s\n", URL)
if !validateGitHubURL(URL) {
t.Error("the URL came back as invalid")
}
}
func TestGetIssueURL(t *testing.T) {
URL, err := getIssueURL("Chadev_ircbot")
if err != nil {
t.Errorf("failed fetching GitHub Issue URL: %s\n", err.Error())
}
t.Logf("returned URL: %s\n", URL)
if !validateGitHubURL(URL) {
t.Error("the URL came back as invalid")
}
}
func TestGetIssueIDURL(t *testing.T) {
URL, err := getIssueURL("Chadev_ircbot")
if err != nil {
t.Errorf("failed fetching GitHub Issue URL: %s\n", err.Error())
}
t.Logf("returned URL: %s\n", URL)
if !validateGitHubURL(URL) {
t.Error("the issue queue URL came back as invalid")
}
URL, err = getIssueIDURL(URL, "#1")
if err != nil {
t.Errorf("failed fetching GitHub Issue URL: %s\n", err.Error())
}
t.Logf("returned URL: %s\n", URL)
if !validateGitHubURL(URL) {
t.Errorf("the issue URL came back as invalid")
}
}