Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Maxim Lebedev | 78755461c2 | |
Maxim Lebedev | 5c41d902c2 | |
Maxim Lebedev | aaccc5766c |
|
@ -1,39 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
## Our Pledge
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project owner at git@toby3d.ru. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
|
@ -41,7 +41,7 @@ func domToNode(domNode *html.Node) interface{} {
|
|||
return nil
|
||||
}
|
||||
|
||||
var nodeElement NodeElement
|
||||
nodeElement := new(NodeElement)
|
||||
|
||||
switch strings.ToLower(domNode.Data) {
|
||||
case "a", "aside", "b", "blockquote", "br", "code", "em", "figcaption", "figure", "h3", "h4", "hr", "i",
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestContentFormat(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
_, err := ContentFormat(42)
|
||||
assert.EqualError(t, ErrInvalidDataType, err.Error())
|
||||
_, err := telegraph.ContentFormat(42)
|
||||
assert.EqualError(t, telegraph.ErrInvalidDataType, err.Error())
|
||||
})
|
||||
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
t.Run("string", func(t *testing.T) {
|
||||
validContentDOM, err := ContentFormat(`<p>Hello, World!</p>`)
|
||||
validContentDOM, err := telegraph.ContentFormat(`<p>Hello, World!</p>`)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, validContentDOM)
|
||||
})
|
||||
t.Run("bytes", func(t *testing.T) {
|
||||
validContentDOM, err := ContentFormat([]byte(`<p>Hello, World!</p>`))
|
||||
validContentDOM, err := telegraph.ContentFormat([]byte(`<p>Hello, World!</p>`))
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, validContentDOM)
|
||||
})
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestCreateAccount(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
t.Run("nil", func(t *testing.T) {
|
||||
_, err := CreateAccount(Account{})
|
||||
_, err := telegraph.CreateAccount(telegraph.Account{})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("without shortname", func(t *testing.T) {
|
||||
_, err := CreateAccount(Account{
|
||||
_, err := telegraph.CreateAccount(telegraph.Account{
|
||||
ShortName: "",
|
||||
AuthorName: "Anonymous",
|
||||
})
|
||||
|
@ -21,7 +22,7 @@ func TestCreateAccount(t *testing.T) {
|
|||
})
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
account, err := CreateAccount(Account{
|
||||
account, err := telegraph.CreateAccount(telegraph.Account{
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
})
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestCreatePage(t *testing.T) {
|
||||
content, err := ContentFormat(`<p>Hello, world!</p>`)
|
||||
content, err := telegraph.ContentFormat(`<p>Hello, world!</p>`)
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
var a Account
|
||||
_, err := a.CreatePage(Page{
|
||||
var a telegraph.Account
|
||||
_, err := a.CreatePage(telegraph.Page{
|
||||
Title: "Sample Page",
|
||||
AuthorName: "Anonymous",
|
||||
Content: content,
|
||||
|
@ -20,13 +21,13 @@ func TestCreatePage(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
a := Account{
|
||||
a := telegraph.Account{
|
||||
AccessToken: "b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb",
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
}
|
||||
|
||||
page, err := a.CreatePage(Page{
|
||||
page, err := a.CreatePage(telegraph.Page{
|
||||
Title: "Sample Page",
|
||||
AuthorName: "Anonymous",
|
||||
Content: content,
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestEditAccountInfo(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
var a Account
|
||||
_, err := a.EditAccountInfo(Account{})
|
||||
var a telegraph.Account
|
||||
_, err := a.EditAccountInfo(telegraph.Account{})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
a := Account{
|
||||
a := telegraph.Account{
|
||||
AccessToken: "b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb",
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
}
|
||||
|
||||
_, err := a.EditAccountInfo(Account{
|
||||
_, err := a.EditAccountInfo(telegraph.Account{
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
})
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestEditPage(t *testing.T) {
|
||||
content, err := ContentFormat("<p>Hello, world!</p>")
|
||||
content, err := telegraph.ContentFormat("<p>Hello, world!</p>")
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
var a Account
|
||||
_, err := a.EditPage(Page{
|
||||
var a telegraph.Account
|
||||
_, err := a.EditPage(telegraph.Page{
|
||||
Title: "Sample Page",
|
||||
AuthorName: "Anonymous",
|
||||
Content: content,
|
||||
|
@ -20,13 +21,13 @@ func TestEditPage(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
a := Account{
|
||||
a := telegraph.Account{
|
||||
AccessToken: "b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb",
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
}
|
||||
|
||||
page, err := a.EditPage(Page{
|
||||
page, err := a.EditPage(telegraph.Page{
|
||||
Path: "Sample-Page-12-15",
|
||||
Title: "Sample Page",
|
||||
AuthorName: "Anonymous",
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestGetAccountInfo(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
var a Account
|
||||
var a telegraph.Account
|
||||
_, err := a.GetAccountInfo()
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
a := Account{
|
||||
a := telegraph.Account{
|
||||
AccessToken: "b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb",
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
}
|
||||
|
||||
info, err := a.GetAccountInfo(FieldShortName, FieldPageCount)
|
||||
info, err := a.GetAccountInfo(telegraph.FieldShortName, telegraph.FieldPageCount)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, a.ShortName, info.ShortName)
|
||||
assert.NotZero(t, info.PageCount)
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestGetPageList(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
var a Account
|
||||
var a telegraph.Account
|
||||
_, err := a.GetPageList(0, 0)
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
a := Account{
|
||||
a := telegraph.Account{
|
||||
AccessToken: "b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb",
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestGetPage(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
_, err := GetPage("wtf", true)
|
||||
_, err := telegraph.GetPage("wtf", true)
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
page, err := GetPage("Sample-Page-12-15", true)
|
||||
page, err := telegraph.GetPage("Sample-Page-12-15", true)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, page)
|
||||
})
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestGetViews(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
t.Run("path", func(t *testing.T) {
|
||||
_, err := GetViews("wtf", time.Time{})
|
||||
_, err := telegraph.GetViews("wtf", time.Time{})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("year", func(t *testing.T) {
|
||||
dt := time.Date(1980, 0, 0, 0, 0, 0, 0, time.UTC)
|
||||
_, err := GetViews("Sample-Page-12-15", dt)
|
||||
_, err := telegraph.GetViews("Sample-Page-12-15", dt)
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("month", func(t *testing.T) {
|
||||
dt := time.Date(2000, 22, 0, 0, 0, 0, 0, time.UTC)
|
||||
result, err := GetViews("Sample-Page-12-15", dt)
|
||||
result, err := telegraph.GetViews("Sample-Page-12-15", dt)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
})
|
||||
t.Run("day", func(t *testing.T) {
|
||||
dt := time.Date(2000, time.February, 42, 0, 0, 0, 0, time.UTC)
|
||||
result, err := GetViews("Sample-Page-12-15", dt)
|
||||
result, err := telegraph.GetViews("Sample-Page-12-15", dt)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
})
|
||||
t.Run("hour", func(t *testing.T) {
|
||||
dt := time.Date(2000, time.February, 12, 65, 0, 0, 0, time.UTC)
|
||||
result, err := GetViews("Sample-Page-12-15", dt)
|
||||
result, err := telegraph.GetViews("Sample-Page-12-15", dt)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
})
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
dt := time.Date(2016, time.December, 31, 0, 0, 0, 0, time.UTC)
|
||||
stats, err := GetViews("Sample-Page-12-15", dt)
|
||||
stats, err := telegraph.GetViews("Sample-Page-12-15", dt)
|
||||
assert.NoError(t, err)
|
||||
if !assert.NotNil(t, stats) {
|
||||
t.FailNow()
|
||||
|
|
8
go.mod
8
go.mod
|
@ -1,13 +1,13 @@
|
|||
module gitlab.com/toby3d/telegraph
|
||||
|
||||
require (
|
||||
github.com/json-iterator/go v1.1.9
|
||||
github.com/klauspost/compress v1.9.7 // indirect
|
||||
github.com/json-iterator/go v1.1.10
|
||||
github.com/klauspost/compress v1.10.9 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/valyala/fasthttp v1.8.0
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
|
||||
github.com/valyala/fasthttp v1.14.0
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
|
||||
)
|
||||
|
||||
go 1.13
|
||||
|
|
25
go.sum
25
go.sum
|
@ -1,14 +1,14 @@
|
|||
github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4=
|
||||
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.9.7 h1:hYW1gP94JUmAhBtJ+LNz5My+gBobDxPR1iVuKug26aA=
|
||||
github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
|
||||
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/klauspost/compress v1.10.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.10.9 h1:pPRt1Z78crspaHISkpSSHjDlx+Tt9suHe519dsI0vF4=
|
||||
github.com/klauspost/compress v1.10.9/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
|
@ -22,12 +22,13 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
|
|||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.8.0 h1:actnGGBYtGQmxVaZxyZpp57Vcc2NhcO7mMN0IMwCC0w=
|
||||
github.com/valyala/fasthttp v1.8.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
|
||||
github.com/valyala/fasthttp v1.14.0 h1:67bfuW9azCMwW/Jlq/C+VeihNpAuJMWkYPBig1gdi3A=
|
||||
github.com/valyala/fasthttp v1.14.0/go.mod h1:ol1PCaL0dX20wC0htZ7sYCsvCYmrouYra0zHzaclZhE=
|
||||
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM=
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
package telegraph
|
||||
package telegraph_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/toby3d/telegraph"
|
||||
)
|
||||
|
||||
func TestRevokeAccessToken(t *testing.T) {
|
||||
t.Run("invalid", func(t *testing.T) {
|
||||
var account Account
|
||||
var account telegraph.Account
|
||||
_, err := account.RevokeAccessToken()
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
a, err := CreateAccount(Account{
|
||||
a, err := telegraph.CreateAccount(telegraph.Account{
|
||||
ShortName: "Sandbox",
|
||||
AuthorName: "Anonymous",
|
||||
})
|
||||
|
|
|
@ -52,7 +52,7 @@ func makeRequest(path string, payload interface{}) ([]byte, error) {
|
|||
}
|
||||
|
||||
if !r.Ok {
|
||||
return nil, errors.New(r.Error)
|
||||
return nil, errors.New(r.Error) //nolint: goerr113
|
||||
}
|
||||
|
||||
return r.Result, nil
|
||||
|
|
Loading…
Reference in New Issue