...
 
Commits (2)
image: golang:1.11
stages:
- test
- build
unit_tests:
stage: test
script:
- go test
build:
stage: build
script:
- go build -i -v
......@@ -2,6 +2,8 @@
A golang client library for pnut.io
Based on peanuts, originally written by yukkuri_sinai, this project aims to create a complete supported library.
### Installation
```sh
......
package woodstock
import (
"encoding/json"
"os"
"testing"
"time"
)
const Delay = 15
const Delay = 5 * time.Second
type Config struct {
ClientID string
......@@ -14,15 +14,8 @@ type Config struct {
}
func GetConfig() (config Config, err error) {
file, err := os.Open("config.json")
if err != nil {
return
}
decoder := json.NewDecoder(file)
err = decoder.Decode(&config)
if err != nil {
return
}
config.ClientID = os.Getenv("PNUT_CLIENT_ID")
config.AccessToken = os.Getenv("PNUT_ACCESS_TOKEN")
return
}
......
......@@ -96,7 +96,7 @@ func TestRevisePost(t *testing.T) {
if err != nil {
t.Error(err)
}
text := "Hello pnut.io"
text := "Hello pnut.io."
new := "Hello pnut.io golang test"
client := NewClient(config.ClientID, "")
client.SetAccessToken(config.AccessToken)
......@@ -122,7 +122,7 @@ func TestDeletePost(t *testing.T) {
if err != nil {
t.Error(err)
}
text := "Hello pnut.io"
text := "Hello pnut.io_"
client := NewClient(config.ClientID, "")
client.SetAccessToken(config.AccessToken)
v := url.Values{}
......
......@@ -197,7 +197,7 @@ func TestFollow(t *testing.T) {
if err != nil {
t.Error(err)
}
userID := "494"
userID := "9"
client := NewClient(config.ClientID, "")
client.SetAccessToken(config.AccessToken)
user, err := client.Follow(userID)
......@@ -215,7 +215,7 @@ func TestUnFollow(t *testing.T) {
if err != nil {
t.Error(err)
}
userID := "494"
userID := "9"
client := NewClient(config.ClientID, "")
client.SetAccessToken(config.AccessToken)
user, err := client.UnFollow(userID)
......