(t *testing.T)
| 35 | var ctxbg = context.Background() |
| 36 | |
| 37 | func TestGetUserID(t *testing.T) { |
| 38 | ctx, cancel := context.WithCancel(context.WithValue(context.TODO(), ctxutil.HTTPClient, &http.Client{ |
| 39 | Transport: httputil.NewFakeTransport(map[string]func() *http.Response{ |
| 40 | apiURL + userInfoAPIPath: httputil.FileResponder(filepath.FromSlash("testdata/verify_credentials-res.json")), |
| 41 | }), |
| 42 | })) |
| 43 | defer cancel() |
| 44 | inf, err := getUserInfo(importer.OAuthContext{Ctx: ctx, Client: &oauth.Client{}, Creds: &oauth.Credentials{}}) |
| 45 | if err != nil { |
| 46 | t.Fatal(err) |
| 47 | } |
| 48 | want := userInfo{ |
| 49 | ID: "2325935334", |
| 50 | ScreenName: "lejatorn", |
| 51 | Name: "Mathieu Lonjaret", |
| 52 | } |
| 53 | if inf != want { |
| 54 | t.Errorf("user info = %+v; want %+v", inf, want) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func checkTweets(t *testing.T, rc *importer.RunContext, expectedPostGroups ...map[string]string) { |
| 59 | postsNode, err := imptest.GetRequiredChildPathObj(rc.RootNode(), "tweets") |
nothing calls this directly
no test coverage detected