summaryrefslogtreecommitdiffstats
path: root/modules/avatar/avatar_test.go
diff options
context:
space:
mode:
authorskyblue <ssx205@gmail.com>2014-03-23 12:24:09 +0800
committerskyblue <ssx205@gmail.com>2014-03-23 12:24:09 +0800
commit8e47ae21024bc35a82215e16f1e586f94ae622c9 (patch)
tree8f82573b400f8833f06bc23bc70d6f3883c99f86 /modules/avatar/avatar_test.go
parent17da2fd2e30e85909394bc58069ecab14d8d8577 (diff)
downloadgitea-8e47ae21024bc35a82215e16f1e586f94ae622c9.tar.gz
gitea-8e47ae21024bc35a82215e16f1e586f94ae622c9.zip
add avatar inorder to view code on github
Diffstat (limited to 'modules/avatar/avatar_test.go')
-rw-r--r--modules/avatar/avatar_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/avatar/avatar_test.go b/modules/avatar/avatar_test.go
new file mode 100644
index 0000000000..49f8f91f35
--- /dev/null
+++ b/modules/avatar/avatar_test.go
@@ -0,0 +1,35 @@
+package avatar
+
+import (
+ "log"
+ "strconv"
+ "testing"
+ "time"
+)
+
+func TestFetch(t *testing.T) {
+ hash := HashEmail("ssx205@gmail.com")
+ avatar := New(hash, "./")
+ //avatar.Update()
+ avatar.UpdateTimeout(time.Millisecond * 200)
+ time.Sleep(5 * time.Second)
+}
+
+func TestFetchMany(t *testing.T) {
+ log.Println("start")
+ var n = 50
+ ch := make(chan bool, n)
+ for i := 0; i < n; i++ {
+ go func(i int) {
+ hash := HashEmail(strconv.Itoa(i) + "ssx205@gmail.com")
+ avatar := New(hash, "./")
+ avatar.Update()
+ log.Println("finish", hash)
+ ch <- true
+ }(i)
+ }
+ for i := 0; i < n; i++ {
+ <-ch
+ }
+ log.Println("end")
+}