aboutsummaryrefslogtreecommitdiffstats
path: root/timetask/http_test.go
diff options
context:
space:
mode:
authorTeddy Wing2017-03-11 10:49:45 +0100
committerTeddy Wing2017-03-11 10:49:45 +0100
commit94d099641cae95724045122de93c826fe054c919 (patch)
treea96ab6d9ffee1768a29711c5fe71b16fb830f515 /timetask/http_test.go
parentd14b4bb9be46396843c346b468dada938364c25b (diff)
downloadtimetasker-94d099641cae95724045122de93c826fe054c919.tar.bz2
Get login working
Fill in the `Login` function to actually log in to Time Task. Pass credentials in via test command flags. Referenced https://gist.github.com/varver/f327ef9087ebf76aa4c4 for the cookie setup.
Diffstat (limited to 'timetask/http_test.go')
-rw-r--r--timetask/http_test.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/timetask/http_test.go b/timetask/http_test.go
index 7adf2c4..e3dad9d 100644
--- a/timetask/http_test.go
+++ b/timetask/http_test.go
@@ -1,12 +1,22 @@
package timetask
import (
+ "flag"
"io/ioutil"
"testing"
)
+var username, password string
+
+func init() {
+ flag.StringVar(&username, "username", "", "Username")
+ flag.StringVar(&password, "password", "", "Password")
+ flag.Parse()
+
+}
+
func TestLogin(t *testing.T) {
- response, _ := Login()
+ response, _ := Login(username, password)
defer response.Body.Close()
body, _ := ioutil.ReadAll(response.Body)
t.Log(response)