-
Notifications
You must be signed in to change notification settings - Fork 246
/
oembed_test.go
39 lines (34 loc) · 1.6 KB
/
oembed_test.go
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
package anaconda_test
import (
"net/url"
"reflect"
"testing"
"github.com/ChimeraCoder/anaconda"
)
func TestOEmbed(t *testing.T) {
// It is the only one that can be tested without auth
// However, it is still rate-limited
api := anaconda.NewTwitterApi("", "")
api.SetBaseUrl(testBase)
o, err := api.GetOEmbed(url.Values{"id": []string{"99530515043983360"}})
if err != nil {
t.Error(err)
}
if !reflect.DeepEqual(o, expectedOEmbed) {
t.Errorf("Actual OEmbed differs expected:\n%#v\n Got: \n%#v\n", expectedOEmbed, o)
}
}
var expectedOEmbed anaconda.OEmbed = anaconda.OEmbed{
Cache_age: "3153600000",
Url: "https://twitter.com/twitter/status/99530515043983360",
Height: 0,
Provider_url: "https://twitter.com",
Provider_name: "Twitter",
Author_name: "Twitter",
Version: "1.0",
Author_url: "https://twitter.com/twitter",
Type: "rich",
Html: `<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Cool! “<a href="https://twitter.com/tw1tt3rart">@tw1tt3rart</a>: <a href="https://twitter.com/hashtag/TWITTERART?src=hash">#TWITTERART</a> ╱╱╱╱╱╱╱╱ ╱╱╭━━━━╮╱╱╭━━━━╮ ╱╱┃▇┆┆▇┃╱╭┫ⓦⓔⓔⓚ┃ ╱╱┃▽▽▽▽┃━╯┃♡ⓔⓝⓓ┃ ╱╭┫△△△△┣╮╱╰━━━━╯ ╱┃┃┆┆┆┆┃┃╱╱╱╱╱╱ ╱┗┫┆┏┓┆┣┛╱╱╱╱╱”</p>— Twitter (@twitter) <a href="https://twitter.com/twitter/status/99530515043983360">August 5, 2011</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>`,
Width: 550,
}