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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
Index: golang-github-stathat-go/stathat_test.go
===================================================================
--- golang-github-stathat-go.orig/stathat_test.go
+++ golang-github-stathat-go/stathat_test.go
@@ -200,121 +200,3 @@ func TestPaths(t *testing.T) {
t.Errorf("expected /v")
}
}
-
-func TestPosts(t *testing.T) {
- setTesting()
- Verbose = true
- PostCountOne("statkey", "userkey")
- p := <-testPostChannel
- if p.url != "http://api.stathat.com/c" {
- t.Errorf("expected classic count url")
- }
- if p.values.Get("key") != "statkey" {
- t.Errorf("expected statkey")
- }
- if p.values.Get("ukey") != "userkey" {
- t.Errorf("expected userkey")
- }
- if p.values.Get("count") != "1" {
- t.Errorf("expected count of 1")
- }
-
- PostCount("statkey", "userkey", 13)
- p = <-testPostChannel
- if p.url != "http://api.stathat.com/c" {
- t.Errorf("expected classic count url")
- }
- if p.values.Get("key") != "statkey" {
- t.Errorf("expected statkey")
- }
- if p.values.Get("ukey") != "userkey" {
- t.Errorf("expected userkey")
- }
- if p.values.Get("count") != "13" {
- t.Errorf("expected count of 13")
- }
-
- PostValue("statkey", "userkey", 9.312)
- p = <-testPostChannel
- if p.url != "http://api.stathat.com/v" {
- t.Errorf("expected classic value url")
- }
- if p.values.Get("key") != "statkey" {
- t.Errorf("expected statkey")
- }
- if p.values.Get("ukey") != "userkey" {
- t.Errorf("expected userkey")
- }
- if p.values.Get("value") != "9.312" {
- t.Errorf("expected value of 9.312")
- }
-
- PostEZCountOne("a stat", "pc@pc.com")
- p = <-testPostChannel
- if p.url != "http://api.stathat.com/ez" {
- t.Errorf("expected ez url")
- }
- if p.values.Get("stat") != "a stat" {
- t.Errorf("expected a stat")
- }
- if p.values.Get("ezkey") != "pc@pc.com" {
- t.Errorf("expected pc@pc.com")
- }
- if p.values.Get("count") != "1" {
- t.Errorf("expected count of 1")
- }
-
- PostEZCount("a stat", "pc@pc.com", 213)
- p = <-testPostChannel
- if p.url != "http://api.stathat.com/ez" {
- t.Errorf("expected ez url")
- }
- if p.values.Get("stat") != "a stat" {
- t.Errorf("expected a stat")
- }
- if p.values.Get("ezkey") != "pc@pc.com" {
- t.Errorf("expected pc@pc.com")
- }
- if p.values.Get("count") != "213" {
- t.Errorf("expected count of 213")
- }
-
- PostEZValue("a stat", "pc@pc.com", 2.13)
- p = <-testPostChannel
- if p.url != "http://api.stathat.com/ez" {
- t.Errorf("expected ez url")
- }
- if p.values.Get("stat") != "a stat" {
- t.Errorf("expected a stat")
- }
- if p.values.Get("ezkey") != "pc@pc.com" {
- t.Errorf("expected pc@pc.com")
- }
- if p.values.Get("value") != "2.13" {
- t.Errorf("expected value of 2.13")
- }
-
- PostCountTime("statkey", "userkey", 13, 100000)
- p = <-testPostChannel
- if p.values.Get("t") != "100000" {
- t.Errorf("expected t value of 100000, got %s", p.values.Get("t"))
- }
-
- PostValueTime("statkey", "userkey", 9.312, 200000)
- p = <-testPostChannel
- if p.values.Get("t") != "200000" {
- t.Errorf("expected t value of 200000, got %s", p.values.Get("t"))
- }
-
- PostEZCountTime("a stat", "pc@pc.com", 213, 300000)
- p = <-testPostChannel
- if p.values.Get("t") != "300000" {
- t.Errorf("expected t value of 300000, got %s", p.values.Get("t"))
- }
-
- PostEZValueTime("a stat", "pc@pc.com", 2.13, 400000)
- p = <-testPostChannel
- if p.values.Get("t") != "400000" {
- t.Errorf("expected t value of 400000, got %s", p.values.Get("t"))
- }
-}
Index: golang-github-stathat-go/example_test.go
===================================================================
--- golang-github-stathat-go.orig/example_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2012 Numerotron Inc.
-// Use of this source code is governed by an MIT-style license
-// that can be found in the LICENSE file.
-
-package stathat_test
-
-import (
- "fmt"
- "github.com/stathat/go"
- "log"
- "time"
-)
-
-func ExamplePostEZCountOne() {
- log.Printf("starting example")
- stathat.Verbose = true
- err := stathat.PostEZCountOne("go example test run", "patrick@stathat.com")
- if err != nil {
- log.Printf("error posting ez count one: %v", err)
- return
- }
- ok := stathat.WaitUntilFinished(5 * time.Second)
- if ok {
- fmt.Println("ok")
- }
- // Output: ok
-}
|