From bab7ff8e14af2abc8947c52be5bdf3fb2963f697 Mon Sep 17 00:00:00 2001 From: Vartan Benohanian Date: Sun, 2 Aug 2020 01:06:25 -0400 Subject: [PATCH] Delete search service, move its methods to other services Signed-off-by: Vartan Benohanian --- reddit.go | 2 - reddit_test.go | 1 - search.go | 100 +------ search_test.go | 260 ------------------ subreddit.go | 29 ++ subreddit_test.go | 130 +++++++++ testdata/search/subreddits.json | 208 -------------- testdata/search/users.json | 138 ---------- .../search-posts.json} | 0 user_test.go | 4 +- 10 files changed, 170 insertions(+), 702 deletions(-) delete mode 100644 search_test.go delete mode 100644 testdata/search/subreddits.json delete mode 100644 testdata/search/users.json rename testdata/{search/posts.json => subreddit/search-posts.json} (100%) diff --git a/reddit.go b/reddit.go index 98e17fe..ef88b64 100644 --- a/reddit.go +++ b/reddit.go @@ -98,7 +98,6 @@ type Client struct { Moderation *ModerationService Multi *MultiService Post *PostService - Search *SearchService Subreddit *SubredditService User *UserService @@ -144,7 +143,6 @@ func newClient(httpClient *http.Client) *Client { c.Listings = &ListingsService{client: c} c.Moderation = &ModerationService{client: c} c.Multi = &MultiService{client: c} - c.Search = &SearchService{client: c} c.Subreddit = &SubredditService{client: c} c.User = &UserService{client: c} diff --git a/reddit_test.go b/reddit_test.go index 8400f52..7f90b37 100644 --- a/reddit_test.go +++ b/reddit_test.go @@ -73,7 +73,6 @@ func testClientServices(t *testing.T, c *Client) { "Moderation", "Multi", "Post", - "Search", "Subreddit", "User", } diff --git a/search.go b/search.go index af0e459..6eede9a 100644 --- a/search.go +++ b/search.go @@ -1,26 +1,19 @@ package reddit import ( - "context" "fmt" - "net/http" "net/url" - "strings" ) -// SearchService handles communication with the search -// related methods of the Reddit API. -// -// For searches to include NSFW results, the user must -// enable the following setting in their preferences: -// "include not safe for work (NSFW) search results in searches" -// Note: The "limit" parameter in searches is prone to inconsistent -// behaviour, e.g. sometimes limit=1 returns nothing when it should. -// -// Reddit API docs: https://www.reddit.com/dev/api/#section_search -type SearchService struct { - client *Client -} +/* + +For searches to include NSFW results, the user must +enable the following setting in their preferences: +"include not safe for work (NSFW) search results in searches" +Note: The "limit" parameter in searches is prone to inconsistent +behaviour, e.g. sometimes limit=1 returns nothing when it should. + +*/ func newSearchOptions(opts ...SearchOptionSetter) url.Values { searchOptions := make(url.Values) @@ -134,7 +127,6 @@ func FromAllTime(opts url.Values) { } // setType sets the type option. -// It could be user, link, sr (subreddit). // For mod actions, it's for the type of action (e.g. "banuser", "spamcomment"). func setType(v string) SearchOptionSetter { return func(opts url.Values) { @@ -153,77 +145,3 @@ func setQuery(v string) SearchOptionSetter { func setRestrict(opts url.Values) { opts.Set("restrict_sr", "true") } - -// Posts searches for posts. -// If the list of subreddits provided is empty, the search is run against r/all. -func (s *SearchService) Posts(ctx context.Context, query string, subreddits []string, opts ...SearchOptionSetter) (*Posts, *Response, error) { - opts = append(opts, setType("link"), setQuery(query)) - - path := "search" - if len(subreddits) > 0 { - path = fmt.Sprintf("r/%s/search", strings.Join(subreddits, "+")) - opts = append(opts, setRestrict) - } - - form := newSearchOptions(opts...) - path = addQuery(path, form) - - req, err := s.client.NewRequest(http.MethodGet, path, nil) - if err != nil { - return nil, nil, err - } - - root := new(rootListing) - resp, err := s.client.Do(ctx, req, root) - if err != nil { - return nil, resp, err - } - - return root.getPosts(), resp, nil -} - -// Subreddits searches for subreddits. -// The sort and timespan options don't affect the results for this search. -func (s *SearchService) Subreddits(ctx context.Context, query string, opts ...SearchOptionSetter) (*Subreddits, *Response, error) { - opts = append(opts, setType("sr"), setQuery(query)) - form := newSearchOptions(opts...) - - path := "search" - path = addQuery(path, form) - - req, err := s.client.NewRequest(http.MethodGet, path, nil) - if err != nil { - return nil, nil, err - } - - root := new(rootListing) - resp, err := s.client.Do(ctx, req, root) - if err != nil { - return nil, resp, err - } - - return root.getSubreddits(), resp, nil -} - -// Users searches for users. -// The sort and timespan options don't affect the results for this search. -func (s *SearchService) Users(ctx context.Context, query string, opts ...SearchOptionSetter) (*Users, *Response, error) { - opts = append(opts, setType("user"), setQuery(query)) - form := newSearchOptions(opts...) - - path := "search" - path = addQuery(path, form) - - req, err := s.client.NewRequest(http.MethodGet, path, nil) - if err != nil { - return nil, nil, err - } - - root := new(rootListing) - resp, err := s.client.Do(ctx, req, root) - if err != nil { - return nil, resp, err - } - - return root.getUsers(), resp, nil -} diff --git a/search_test.go b/search_test.go deleted file mode 100644 index 37ecbfb..0000000 --- a/search_test.go +++ /dev/null @@ -1,260 +0,0 @@ -package reddit - -import ( - "encoding/json" - "fmt" - "net/http" - "net/url" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -var expectedSearchPosts = &Posts{ - Posts: []*Post{ - { - ID: "hybow9", - FullID: "t3_hybow9", - Created: &Timestamp{time.Date(2020, 7, 26, 18, 14, 24, 0, time.UTC)}, - Edited: &Timestamp{time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)}, - - Permalink: "https://www.reddit.com/r/WatchPeopleDieInside/comments/hybow9/pregnancy_test/", - URL: "https://v.redd.it/ra4qnt8bt8d51", - - Title: "Pregnancy test", - - Score: 103829, - UpvoteRatio: 0.88, - NumberOfComments: 3748, - - SubredditID: "t5_3h4zq", - SubredditName: "WatchPeopleDieInside", - SubredditNamePrefixed: "r/WatchPeopleDieInside", - - AuthorID: "t2_3p32m02", - AuthorName: "chocolat_ice_cream", - }, - { - ID: "hmwhd7", - FullID: "t3_hmwhd7", - Created: &Timestamp{time.Date(2020, 7, 7, 15, 19, 42, 0, time.UTC)}, - Edited: &Timestamp{time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)}, - - Permalink: "https://www.reddit.com/r/worldnews/comments/hmwhd7/brazilian_president_jair_bolsonaro_tests_positive/", - URL: "https://www.theguardian.com/world/2020/jul/07/jair-bolsonaro-coronavirus-positive-test-brazil-president", - - Title: "Brazilian president Jair Bolsonaro tests positive for coronavirus", - - Score: 149238, - UpvoteRatio: 0.94, - NumberOfComments: 7415, - - SubredditID: "t5_2qh13", - SubredditName: "worldnews", - SubredditNamePrefixed: "r/worldnews", - - AuthorID: "t2_wgrkg", - AuthorName: "Jeremy_Martin", - }, - }, - After: "t3_hmwhd7", -} - -var expectedSearchUsers = &Users{ - Users: []*User{ - { - ID: "abc", - Name: "user1", - Created: &Timestamp{time.Date(2019, 8, 14, 23, 38, 42, 0, time.UTC)}, - - PostKarma: 5730, - CommentKarma: 11740, - - HasVerifiedEmail: true, - }, - { - ID: "def", - Name: "user2", - Created: &Timestamp{time.Date(2020, 5, 7, 3, 16, 46, 0, time.UTC)}, - - PostKarma: 2485, - CommentKarma: 127, - }, - }, -} - -var expectedSearchSubreddits = &Subreddits{ - Subreddits: []*Subreddit{ - { - ID: "2qh23", - FullID: "t5_2qh23", - Created: &Timestamp{time.Date(2008, 1, 25, 5, 11, 28, 0, time.UTC)}, - - URL: "/r/test/", - Name: "test", - NamePrefixed: "r/test", - Title: "Testing", - Type: "public", - - Subscribers: 8174, - }, - { - ID: "333yu", - FullID: "t5_333yu", - Created: &Timestamp{time.Date(2014, 8, 18, 23, 29, 47, 0, time.UTC)}, - - URL: "/r/trollingforababy/", - Name: "trollingforababy", - NamePrefixed: "r/trollingforababy", - Title: "Crushing it with reddit karma", - Description: "This is a group for laughing at and mocking the awkward, ridiculous, and sometimes painful things we endure while trying for a baby. Trollingforababy is for people who are trying to conceive, and are not currently pregnant. \n\nPlease look at our complete list of rules before participating.", - Type: "public", - - Subscribers: 10244, - }, - }, - After: "t5_333yu", -} - -func TestSearchService_Posts(t *testing.T) { - setup() - defer teardown() - - blob, err := readFileContents("testdata/search/posts.json") - assert.NoError(t, err) - - mux.HandleFunc("/search", func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, http.MethodGet, r.Method) - - form := url.Values{} - form.Set("type", "link") - form.Set("q", "test") - form.Set("after", "t3_testpost") - - err := r.ParseForm() - assert.NoError(t, err) - assert.Equal(t, form, r.Form) - - fmt.Fprint(w, blob) - }) - - posts, _, err := client.Search.Posts(ctx, "test", nil, SetAfter("t3_testpost")) - assert.NoError(t, err) - assert.Equal(t, expectedSearchPosts, posts) -} - -func TestSearchService_Posts_InSubreddit(t *testing.T) { - setup() - defer teardown() - - blob, err := readFileContents("testdata/search/posts.json") - assert.NoError(t, err) - - mux.HandleFunc("/r/test/search", func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, http.MethodGet, r.Method) - - form := url.Values{} - form.Set("type", "link") - form.Set("q", "test") - form.Set("restrict_sr", "true") - form.Set("after", "t3_testpost") - - err := r.ParseForm() - assert.NoError(t, err) - assert.Equal(t, form, r.Form) - - fmt.Fprint(w, blob) - }) - - posts, _, err := client.Search.Posts(ctx, "test", []string{"test"}, SetAfter("t3_testpost")) - assert.NoError(t, err) - assert.Equal(t, expectedSearchPosts, posts) -} - -func TestSearchService_Posts_InSubreddits(t *testing.T) { - setup() - defer teardown() - - blob, err := readFileContents("testdata/search/posts.json") - assert.NoError(t, err) - - mux.HandleFunc("/r/test+golang+nba/search", func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, http.MethodGet, r.Method) - - form := url.Values{} - form.Set("type", "link") - form.Set("q", "test") - form.Set("restrict_sr", "true") - form.Set("after", "t3_testpost") - - err := r.ParseForm() - assert.NoError(t, err) - assert.Equal(t, form, r.Form) - - fmt.Fprint(w, blob) - }) - - posts, _, err := client.Search.Posts(ctx, "test", []string{"test", "golang", "nba"}, SetAfter("t3_testpost")) - assert.NoError(t, err) - assert.Equal(t, expectedSearchPosts, posts) -} - -func TestSearchService_Subreddits(t *testing.T) { - setup() - defer teardown() - - blob, err := readFileContents("testdata/search/subreddits.json") - assert.NoError(t, err) - - mux.HandleFunc("/search", func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, http.MethodGet, r.Method) - - form := url.Values{} - form.Set("type", "sr") - form.Set("q", "test") - form.Set("before", "t5_testsr") - - err := r.ParseForm() - assert.NoError(t, err) - assert.Equal(t, form, r.Form) - - fmt.Fprint(w, blob) - }) - - subreddits, _, err := client.Search.Subreddits(ctx, "test", SetBefore("t5_testsr")) - assert.NoError(t, err) - assert.Equal(t, expectedSearchSubreddits, subreddits) -} - -func TestSearchService_Users(t *testing.T) { - setup() - defer teardown() - - blob, err := readFileContents("testdata/search/users.json") - assert.NoError(t, err) - - mux.HandleFunc("/search", func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, http.MethodGet, r.Method) - - form := url.Values{} - form.Set("type", "user") - form.Set("q", "test") - form.Set("limit", "2") - - err := r.ParseForm() - assert.NoError(t, err) - assert.Equal(t, form, r.Form) - - fmt.Fprint(w, blob) - }) - - users, _, err := client.Search.Users(ctx, "test", SetLimit(2)) - assert.NoError(t, err) - assert.Equal(t, expectedSearchUsers, users) -} - -func printJSON(v interface{}) { - b, _ := json.MarshalIndent(v, "", " ") - fmt.Println(string(b)) -} diff --git a/subreddit.go b/subreddit.go index 066e522..9a9718e 100644 --- a/subreddit.go +++ b/subreddit.go @@ -243,6 +243,35 @@ func (s *SubredditService) SearchNames(ctx context.Context, query string) ([]str return root.Names, resp, nil } +// SearchPosts searches for posts. +// If the list of subreddits provided is empty, the search is run against r/all. +func (s *SubredditService) SearchPosts(ctx context.Context, query string, subreddits []string, opts ...SearchOptionSetter) (*Posts, *Response, error) { + if len(subreddits) > 0 { + opts = append(opts, setRestrict) + } else { + subreddits = append(subreddits, "all") + } + + opts = append(opts, setQuery(query)) + form := newSearchOptions(opts...) + + path := fmt.Sprintf("r/%s/search", strings.Join(subreddits, "+")) + path = addQuery(path, form) + + req, err := s.client.NewRequest(http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(rootListing) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.getPosts(), resp, nil +} + func (s *SubredditService) getSubreddits(ctx context.Context, path string, opts *ListOptions) (*Subreddits, *Response, error) { path, err := addOptions(path, opts) if err != nil { diff --git a/subreddit_test.go b/subreddit_test.go index cc578a3..5d89c13 100644 --- a/subreddit_test.go +++ b/subreddit_test.go @@ -150,6 +150,56 @@ var expectedSubredditNames = []string{ "golang_jobs", } +var expectedSearchPosts = &Posts{ + Posts: []*Post{ + { + ID: "hybow9", + FullID: "t3_hybow9", + Created: &Timestamp{time.Date(2020, 7, 26, 18, 14, 24, 0, time.UTC)}, + Edited: &Timestamp{time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)}, + + Permalink: "https://www.reddit.com/r/WatchPeopleDieInside/comments/hybow9/pregnancy_test/", + URL: "https://v.redd.it/ra4qnt8bt8d51", + + Title: "Pregnancy test", + + Score: 103829, + UpvoteRatio: 0.88, + NumberOfComments: 3748, + + SubredditID: "t5_3h4zq", + SubredditName: "WatchPeopleDieInside", + SubredditNamePrefixed: "r/WatchPeopleDieInside", + + AuthorID: "t2_3p32m02", + AuthorName: "chocolat_ice_cream", + }, + { + ID: "hmwhd7", + FullID: "t3_hmwhd7", + Created: &Timestamp{time.Date(2020, 7, 7, 15, 19, 42, 0, time.UTC)}, + Edited: &Timestamp{time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)}, + + Permalink: "https://www.reddit.com/r/worldnews/comments/hmwhd7/brazilian_president_jair_bolsonaro_tests_positive/", + URL: "https://www.theguardian.com/world/2020/jul/07/jair-bolsonaro-coronavirus-positive-test-brazil-president", + + Title: "Brazilian president Jair Bolsonaro tests positive for coronavirus", + + Score: 149238, + UpvoteRatio: 0.94, + NumberOfComments: 7415, + + SubredditID: "t5_2qh13", + SubredditName: "worldnews", + SubredditNamePrefixed: "r/worldnews", + + AuthorID: "t2_wgrkg", + AuthorName: "Jeremy_Martin", + }, + }, + After: "t3_hmwhd7", +} + var expectedModerators = []Moderator{ {ID: "t2_test1", Name: "testuser1", Permissions: []string{"all"}}, {ID: "t2_test2", Name: "testuser2", Permissions: []string{"all"}}, @@ -567,6 +617,86 @@ func TestSubredditService_SearchNames(t *testing.T) { assert.Equal(t, expectedSubredditNames, names) } +func TestSubredditService_SearchPosts(t *testing.T) { + setup() + defer teardown() + + blob, err := readFileContents("testdata/subreddit/search-posts.json") + assert.NoError(t, err) + + mux.HandleFunc("/r/all/search", func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, http.MethodGet, r.Method) + + form := url.Values{} + form.Set("q", "test") + form.Set("after", "t3_testpost") + + err := r.ParseForm() + assert.NoError(t, err) + assert.Equal(t, form, r.Form) + + fmt.Fprint(w, blob) + }) + + posts, _, err := client.Subreddit.SearchPosts(ctx, "test", nil, SetAfter("t3_testpost")) + assert.NoError(t, err) + assert.Equal(t, expectedSearchPosts, posts) +} + +func TestSubredditService_SearchPosts_InSubreddit(t *testing.T) { + setup() + defer teardown() + + blob, err := readFileContents("testdata/subreddit/search-posts.json") + assert.NoError(t, err) + + mux.HandleFunc("/r/test/search", func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, http.MethodGet, r.Method) + + form := url.Values{} + form.Set("q", "test") + form.Set("restrict_sr", "true") + form.Set("after", "t3_testpost") + + err := r.ParseForm() + assert.NoError(t, err) + assert.Equal(t, form, r.Form) + + fmt.Fprint(w, blob) + }) + + posts, _, err := client.Subreddit.SearchPosts(ctx, "test", []string{"test"}, SetAfter("t3_testpost")) + assert.NoError(t, err) + assert.Equal(t, expectedSearchPosts, posts) +} + +func TestSubredditService_SearchPosts_InSubreddits(t *testing.T) { + setup() + defer teardown() + + blob, err := readFileContents("testdata/subreddit/search-posts.json") + assert.NoError(t, err) + + mux.HandleFunc("/r/test+golang+nba/search", func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, http.MethodGet, r.Method) + + form := url.Values{} + form.Set("q", "test") + form.Set("restrict_sr", "true") + form.Set("after", "t3_testpost") + + err := r.ParseForm() + assert.NoError(t, err) + assert.Equal(t, form, r.Form) + + fmt.Fprint(w, blob) + }) + + posts, _, err := client.Subreddit.SearchPosts(ctx, "test", []string{"test", "golang", "nba"}, SetAfter("t3_testpost")) + assert.NoError(t, err) + assert.Equal(t, expectedSearchPosts, posts) +} + func TestSubredditService_Moderators(t *testing.T) { setup() defer teardown() diff --git a/testdata/search/subreddits.json b/testdata/search/subreddits.json deleted file mode 100644 index 989e7c7..0000000 --- a/testdata/search/subreddits.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "kind": "Listing", - "data": { - "after": "t5_333yu", - "dist": 2, - "facets": {}, - "modhash": null, - "children": [ - { - "kind": "t5", - "data": { - "user_flair_background_color": null, - "submit_text_html": null, - "restrict_posting": true, - "user_is_banned": false, - "free_form_reports": true, - "wiki_enabled": null, - "user_is_muted": false, - "user_can_flair_in_sr": null, - "display_name": "test", - "header_img": null, - "title": "Testing", - "allow_galleries": true, - "icon_size": null, - "primary_color": "", - "active_user_count": null, - "icon_img": "", - "display_name_prefixed": "r/test", - "accounts_active": null, - "public_traffic": false, - "subscribers": 8174, - "user_flair_richtext": [], - "videostream_links_count": 1, - "name": "t5_2qh23", - "quarantine": false, - "hide_ads": false, - "emojis_enabled": false, - "advertiser_category": "", - "public_description": "", - "comment_score_hide_mins": 0, - "user_has_favorited": false, - "user_flair_template_id": null, - "community_icon": "", - "banner_background_image": "", - "original_content_tag_enabled": false, - "submit_text": "", - "description_html": "<!-- SC_OFF --><div class=\"md\"><p>This is a place to test things.</p>\n</div><!-- SC_ON -->", - "spoilers_enabled": true, - "header_title": null, - "header_size": null, - "user_flair_position": "right", - "all_original_content": false, - "has_menu_widget": false, - "is_enrolled_in_new_modmail": null, - "key_color": "", - "can_assign_user_flair": true, - "created": 1201266688, - "wls": 6, - "show_media_preview": true, - "submission_type": "any", - "user_is_subscriber": true, - "disable_contributor_requests": false, - "allow_videogifs": true, - "user_flair_type": "text", - "allow_polls": true, - "collapse_deleted_comments": false, - "emojis_custom_size": null, - "public_description_html": null, - "allow_videos": true, - "is_crosspostable_subreddit": true, - "suggested_comment_sort": null, - "can_assign_link_flair": true, - "accounts_active_is_fuzzed": false, - "submit_text_label": null, - "link_flair_position": "left", - "user_sr_flair_enabled": null, - "user_flair_enabled_in_sr": false, - "allow_chat_post_creation": false, - "allow_discovery": true, - "user_sr_theme_enabled": true, - "link_flair_enabled": true, - "subreddit_type": "public", - "notification_level": "low", - "banner_img": "", - "user_flair_text": null, - "banner_background_color": "", - "show_media": true, - "id": "2qh23", - "user_is_contributor": false, - "over18": false, - "description": "This is a place to test things.", - "is_chat_post_feature_enabled": true, - "submit_link_label": null, - "user_flair_text_color": null, - "restrict_commenting": false, - "user_flair_css_class": null, - "allow_images": true, - "lang": "en", - "whitelist_status": "all_ads", - "url": "/r/test/", - "created_utc": 1201237888, - "banner_size": null, - "mobile_banner_image": "", - "user_is_moderator": false - } - }, - { - "kind": "t5", - "data": { - "user_flair_background_color": null, - "submit_text_html": "<!-- SC_OFF --><div class=\"md\"><p>Are you sure your period is <a href=\"https://www.reddit.com/r/TryingForABaby/comments/6tkj5t/your_period_isnt_late_part_i/\">late?</a></p>\n</div><!-- SC_ON -->", - "restrict_posting": true, - "user_is_banned": false, - "free_form_reports": true, - "wiki_enabled": null, - "user_is_muted": false, - "user_can_flair_in_sr": null, - "display_name": "trollingforababy", - "header_img": "https://a.thumbs.redditmedia.com/GF0lEb4spbJnFGxyTEIVXPErDNEiDSVK4PEMLPvr318.png", - "title": "Crushing it with reddit karma", - "allow_galleries": true, - "icon_size": null, - "primary_color": "", - "active_user_count": null, - "icon_img": "", - "display_name_prefixed": "r/trollingforababy", - "accounts_active": null, - "public_traffic": false, - "subscribers": 10244, - "user_flair_richtext": [], - "videostream_links_count": 1, - "name": "t5_333yu", - "quarantine": false, - "hide_ads": false, - "emojis_enabled": false, - "advertiser_category": "", - "public_description": "This is a group for laughing at and mocking the awkward, ridiculous, and sometimes painful things we endure while trying for a baby. Trollingforababy is for people who are trying to conceive, and are not currently pregnant. \n\nPlease look at our complete list of rules before participating.", - "comment_score_hide_mins": 0, - "user_has_favorited": false, - "user_flair_template_id": null, - "community_icon": "", - "banner_background_image": "", - "original_content_tag_enabled": false, - "submit_text": "Are you sure your period is [late?](https://www.reddit.com/r/TryingForABaby/comments/6tkj5t/your_period_isnt_late_part_i/)", - "description_html": "<!-- SC_OFF --><div class=\"md\"><p>&nbsp;</p>\n\n<table><thead>\n<tr>\n<th>This is a group for laughing at and mocking the awkward, ridiculous, and sometimes painful things we endure while <em>trying</em> for a baby. Salt and bitterness allowed, infertility sucks and there are few havens that are available for venting the frustrations that go along with it. Trollingforababy is for people who are trying to conceive, and are not currently pregnant.</th>\n</tr>\n</thead><tbody>\n</tbody></table>\n\n<p>&nbsp;</p>\n\n<p><strong>The Rules:</strong></p>\n\n<ul>\n<li><p>Posts should be related to <em>trying</em> for a baby.</p></li>\n<li><p>Trollingforababy is for people who are trying to conceive, and are not currently pregnant.</p></li>\n<li><p>Posts should contain an image or gif, no text-only submissions. </p></li>\n<li><p>No announcing or discussing BFPs (positive pregnancy tests). </p></li>\n<li><p>No discussion of living children or pregnancies. </p></li>\n<li><p>No gifs or images containing human babies, toddlers, or small children.</p></li>\n<li><p>No gifs or images containing pregnant women.</p></li>\n<li><p>No gifs or images that are graphic, bloody, or gruesome, especially in the context of miscarriage. These posts can be extremely triggering for our members, especially those who have experienced loss.</p></li>\n<li><p>No posts or discussion of abortion, whether your own or someone else&#39;s. This rule is to avoid triggering content, but also to uphold others&#39; rights to reproductive choice.</p></li>\n<li><p>Be kind and respectful- excessively rude/derogatory comments will be removed.</p></li>\n<li><p>We love gifs and trolling but there is a 2 post per 24 hour post limit (per user). </p></li>\n<li><p>No throwaway accounts for posts or comments. </p></li>\n<li><p>Please use the [NSFW] tag when appropriate. </p></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<table><thead>\n<tr>\n<th>Please report inappropriate content! We want this to be a safe space where we can laugh about trying for that elusive baby. While we are trollingforababy, we <em>do not</em> tolerate general trolls who mock sensitive reproductive subjects. We are pro ART, and are accepting of all reproductive journeys.</th>\n</tr>\n</thead><tbody>\n</tbody></table>\n\n<table><thead>\n<tr>\n<th>There is no such thing as TMI.</th>\n</tr>\n</thead><tbody>\n</tbody></table>\n\n<table><thead>\n<tr>\n<th>If you can&#39;t find the humor here, perhaps this is not for you.</th>\n</tr>\n</thead><tbody>\n</tbody></table>\n\n<table><thead>\n<tr>\n<th>Acronym</th>\n<th>Term</th>\n</tr>\n</thead><tbody>\n<tr>\n<td>2WW</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_surviving_the_.22two-week_wait.22\">Two-Week Wait (post ovulation)</a></td>\n</tr>\n<tr>\n<td>AF</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Menstruation\">Aunt Flow (period)</a></td>\n</tr>\n<tr>\n<td>AI</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Artificial_insemination\">Artificial Insemination</a></td>\n</tr>\n<tr>\n<td>AMH</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Anti-M%C3%BCllerian_hormone\">Anti-Mullerian Hormone</a></td>\n</tr>\n<tr>\n<td>ART</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Assisted_reproductive_technology\">Assisted Reproductive Technology</a></td>\n</tr>\n<tr>\n<td>BBT</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/temping\">Basal Body Temperature</a></td>\n</tr>\n<tr>\n<td>BCP</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Oral_contraceptive_pill\">Birth Control Pills </a></td>\n</tr>\n<tr>\n<td>BCW</td>\n<td>Birth Control Withdrawal</td>\n</tr>\n<tr>\n<td>BFN</td>\n<td>Big Fat Negative</td>\n</tr>\n<tr>\n<td>BFP</td>\n<td>Big Fat Positive</td>\n</tr>\n<tr>\n<td>CD</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Menstrual_cycle\">Cycle Day</a></td>\n</tr>\n<tr>\n<td>CM</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/cm\">Cervical Mucus</a></td>\n</tr>\n<tr>\n<td>CP</td>\n<td><a href=\"https://www.reddit.com/r/TryingForABaby/comments/7j53u1/chemical_pregnancy_info_post_tw_for_discussion_of/\">Chemical Pregnancy</a></td>\n</tr>\n<tr>\n<td>D&amp;C</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Dilation_and_curettage\">Dilation &amp; Curettage</a></td>\n</tr>\n<tr>\n<td>DNLTYD</td>\n<td>Do Not Lie To Your Doctor</td>\n</tr>\n<tr>\n<td>DPO</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Menstrual_cycle\">Days Post-Ovulation</a></td>\n</tr>\n<tr>\n<td>DS</td>\n<td><a href=\"https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_sperm_donation\">Donor Sperm</a></td>\n</tr>\n<tr>\n<td>ENDO</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Endometriosis\">Endometriosis</a></td>\n</tr>\n<tr>\n<td>EOD</td>\n<td>Every Other Day</td>\n</tr>\n<tr>\n<td>EWCM</td>\n<td>Egg White Cervical Mucus</td>\n</tr>\n<tr>\n<td>EP</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Ectopic_pregnancy\">Ectopic Pregnancy</a></td>\n</tr>\n<tr>\n<td>ER</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Transvaginal_oocyte_retrieval\">Egg Retrieval</a></td>\n</tr>\n<tr>\n<td>ET</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Embryo_transfer\">Embryo Transfer</a></td>\n</tr>\n<tr>\n<td>FET</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Embryo_transfer#Fresh_versus_frozen\">Frozen Embryo Transfer</a></td>\n</tr>\n<tr>\n<td>FF</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_any_recommended_apps.3F\">FertilityFriend.com</a></td>\n</tr>\n<tr>\n<td>FMU</td>\n<td><a href=\"http://www.early-pregnancy-tests.com/firstmorningurine.html\">First Morning Urine</a></td>\n</tr>\n<tr>\n<td>FP</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Follicular_phase\">Follicular Phase</a></td>\n</tr>\n<tr>\n<td>FRER</td>\n<td>First Response Early Result pregnancy test</td>\n</tr>\n<tr>\n<td>FW</td>\n<td>Fertile Window</td>\n</tr>\n<tr>\n<td>GP</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_gp\">General Practitioner</a> or Gestating Partner</td>\n</tr>\n<tr>\n<td>GS</td>\n<td><a href=\"https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_gestational_carrier_.28surrogacy.29\">Gestational Surrogate</a></td>\n</tr>\n<tr>\n<td>HBC</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Hormonal_contraception\">Hormonal Birth Control</a></td>\n</tr>\n<tr>\n<td>HCG</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Human_chorionic_gonadotropin\">Human Chorionic Gonadotropin</a></td>\n</tr>\n<tr>\n<td>HPT</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_when_to_use_a_pregnancy_test_.28hpt.29\">Home Pregnancy Test </a></td>\n</tr>\n<tr>\n<td>HSC</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_hysteroscopy\">HysteroSCopy </a></td>\n</tr>\n<tr>\n<td>HSG</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_hsg\">HysteroSalpingoGram</a></td>\n</tr>\n<tr>\n<td>IBIAM</td>\n<td>Implantation Bleeding is a Myth</td>\n</tr>\n<tr>\n<td>ICI</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Artificial_insemination#Intracervical_insemination\">Intracervical Insemination</a></td>\n</tr>\n<tr>\n<td>ICSI</td>\n<td><a href=\"https://www.reddit.com/r/infertility/comments/8tubh8/faq_tell_me_about_intracytoplasmic_sperm/\">Intra-Cytoplasmic Sperm Injection</a></td>\n</tr>\n<tr>\n<td>IF</td>\n<td>Infertility</td>\n</tr>\n<tr>\n<td>IJP</td>\n<td>It’s Just Progesterone</td>\n</tr>\n<tr>\n<td>IKMTMD</td>\n<td>I Know More Than My Doctor</td>\n</tr>\n<tr>\n<td>IM</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Intramuscular_injection\">Intra-Muscular Injection</a></td>\n</tr>\n<tr>\n<td>IUI</td>\n<td><a href=\"https://www.reddit.com/r/infertility/comments/1zxhu7/faqtell_me_about_your_iui/\">Intra-Uterine Insemination</a></td>\n</tr>\n<tr>\n<td>IVF</td>\n<td><a href=\"https://www.reddit.com/r/infertility/comments/1zxhwh/faqtell_me_about_your_ivf/\">In Vitro Fertilization</a></td>\n</tr>\n<tr>\n<td>LAP</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_laparoscopy\">Laparoscopy</a></td>\n</tr>\n<tr>\n<td>LH</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Luteinizing_hormone\">Luteinizing Hormone</a></td>\n</tr>\n<tr>\n<td>LMP</td>\n<td>Last Menstrual Period</td>\n</tr>\n<tr>\n<td>LO</td>\n<td>Little One (children)</td>\n</tr>\n<tr>\n<td>LP</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Luteal_phase\">Luteal Phase</a></td>\n</tr>\n<tr>\n<td>LPD</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Luteal_phase#Luteal_phase_defect\">Luteal Phase Defect</a></td>\n</tr>\n<tr>\n<td>MC, M/C, MISC</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Miscarriage\">Miscarriage</a></td>\n</tr>\n<tr>\n<td>MMC</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Miscarriage#missed\">Missed Miscarriage</a></td>\n</tr>\n<tr>\n<td>MF or MFI</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Male_infertility\">Male Factor Infertility</a></td>\n</tr>\n<tr>\n<td>MRKH</td>\n<td><a href=\"https://en.wikipedia.org/wiki/M%C3%BCllerian_agenesis\">Mayer-Rokitansky-Kuster-Hauser syndrome</a></td>\n</tr>\n<tr>\n<td>NCCWPI</td>\n<td>Normal Coffee Consumption Won’t Prevent Implantation</td>\n</tr>\n<tr>\n<td>NGP</td>\n<td>Non-Gestating Partner</td>\n</tr>\n<tr>\n<td>NOWTSYC1BFPPL</td>\n<td>No One Wants to See Your Cycle 1 BFP Please Leave</td>\n</tr>\n<tr>\n<td>NTNP</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_ntnp\">Not Trying, Not Preventing</a></td>\n</tr>\n<tr>\n<td>O, OV</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Ovulation\">Ovulation</a></td>\n</tr>\n<tr>\n<td>OB/GYN, OBGYN</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_obgyn\">Obstetrician/Gynecologist </a></td>\n</tr>\n<tr>\n<td>OHSS</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Ovarian_hyperstimulation_syndrome\">Ovarian HyperStimulation Sydrome</a></td>\n</tr>\n<tr>\n<td>OPK</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/opks\">Ovulation Predictor Kit or Test</a></td>\n</tr>\n<tr>\n<td>OTMN</td>\n<td>One Temp Means Nothing</td>\n</tr>\n<tr>\n<td>PCO and PCOS</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Polycystic_ovary_syndrome\">PolyCystic Ovar(ies) and PolyCystic Ovary Syndrome</a></td>\n</tr>\n<tr>\n<td>PCP</td>\n<td>Primary Care Physician</td>\n</tr>\n<tr>\n<td>PFIIMUB</td>\n<td>Pineapple for Implantation is Made Up Bullshit</td>\n</tr>\n<tr>\n<td>PGD and PGS</td>\n<td><a href=\"https://www.reddit.com/r/infertility/comments/9gkyc6/faq_tell_me_about_pgd_testing/\">Pre-implantation Genetic Diagnosis</a> and <a href=\"https://www.reddit.com/r/infertility/comments/21tzum/faqtell_me_about_pgs/\">Screening</a></td>\n</tr>\n<tr>\n<td>PIO</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Pharmacology_of_progesterone#Intramuscular_injection\">Progesterone in Oil</a></td>\n</tr>\n<tr>\n<td>POAS</td>\n<td>Pee On a Stick</td>\n</tr>\n<tr>\n<td>RE</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_re\">Reproductive Endocrinologist </a></td>\n</tr>\n<tr>\n<td>RIVF</td>\n<td><a href=\"https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_reciprocal_ivf\">Reciprocal IVF</a></td>\n</tr>\n<tr>\n<td>RPL</td>\n<td><a href=\"https://www.reddit.com/r/infertility/comments/1vs5cq/faqtell_me_about_rpl_recurrent_pregnancy_loss/\">Recurrent Pregnancy Loss</a></td>\n</tr>\n<tr>\n<td>SA</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_semen_analysis\">Semen Analysis </a></td>\n</tr>\n<tr>\n<td>SART</td>\n<td><a href=\"https://www.sart.org/\">Society of Assisted Reproductive Technology</a></td>\n</tr>\n<tr>\n<td>SD</td>\n<td><a href=\"https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_sperm_donation\">Sperm Donor</a></td>\n</tr>\n<tr>\n<td>SDCMC</td>\n<td>Stress Doesn’t Cause Miscarriages</td>\n</tr>\n<tr>\n<td>SHG</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Gynecologic_ultrasonography\">SonoHysteroGram</a></td>\n</tr>\n<tr>\n<td>SMEP</td>\n<td><a href=\"http://spermmeetseggplan.com/\">Sperm Meets Egg Plan</a></td>\n</tr>\n<tr>\n<td>STHM</td>\n<td>Spearmint Tea Hail Mary</td>\n</tr>\n<tr>\n<td>SubQ</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Subcutaneous_injection\">Subcutaneous Injection</a></td>\n</tr>\n<tr>\n<td>TCOYF</td>\n<td><a href=\"https://www.amazon.com/gp/product/0062326031/\">Taking Charge of Your Fertility</a></td>\n</tr>\n<tr>\n<td>TESA and TESE</td>\n<td><a href=\"https://www.reddit.com/r/infertility/comments/8z0oni/faq_tell_me_about_tese_mtese/\">Testicular Sperm Aspiration and Testicular Sperm Extraction</a></td>\n</tr>\n<tr>\n<td>TI</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_tracking\">Timed Intercourse</a></td>\n</tr>\n<tr>\n<td>TTC</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/newtottc\">Trying to Conceive</a></td>\n</tr>\n<tr>\n<td>TS</td>\n<td><a href=\"https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_gestational_carrier_.28surrogacy.29\">Traditional Surrogacy</a></td>\n</tr>\n<tr>\n<td>TSH</td>\n<td><a href=\"https://en.wikipedia.org/wiki/Thyroid-stimulating_hormone\">Thyroid Stimulating Hormone</a></td>\n</tr>\n<tr>\n<td>TW/CW</td>\n<td>Trigger Warning or Content Warning</td>\n</tr>\n<tr>\n<td>TWW</td>\n<td><a href=\"https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_surviving_the_.22two-week_wait.22\">Two-Week Wait (post ovulation)</a></td>\n</tr>\n<tr>\n<td>WROG</td>\n<td>Well Read on Google</td>\n</tr>\n</tbody></table>\n\n<table><thead>\n<tr>\n<th><strong>RELATED SUBREDDITS</strong></th>\n</tr>\n</thead><tbody>\n</tbody></table>\n\n<p><a href=\"/r/TryingForABaby\">/r/TryingForABaby</a></p>\n\n<p><a href=\"/r/TFABChartStalkers\">/r/TFABChartStalkers</a></p>\n\n<p><a href=\"/r/TFABLinePorn\">/r/TFABLinePorn</a></p>\n\n<p><a href=\"/r/TTCafterloss\">/r/TTCafterloss</a></p>\n\n<p><a href=\"/r/StillTrying\">/r/StillTrying</a></p>\n\n<p><a href=\"/r/Infertility\">/r/Infertility</a></p>\n\n<p><a href=\"/r/MaleInfertility\">/r/MaleInfertility</a></p>\n\n<p><a href=\"/r/queerception\">/r/queerception</a></p>\n\n<p><a href=\"/r/TTC_PCOS\">/r/TTC_PCOS</a></p>\n\n<p><a href=\"/r/TTC30\">/r/TTC30</a></p>\n\n<p><a href=\"/r/shittyfertilityadvice\">/r/shittyfertilityadvice</a></p>\n</div><!-- SC_ON -->", - "spoilers_enabled": true, - "header_title": "is reddit karma crushing it?", - "header_size": [570, 804], - "user_flair_position": "right", - "all_original_content": false, - "has_menu_widget": false, - "is_enrolled_in_new_modmail": null, - "key_color": "#ea0027", - "can_assign_user_flair": true, - "created": 1408433387, - "wls": null, - "show_media_preview": true, - "submission_type": "any", - "user_is_subscriber": false, - "disable_contributor_requests": false, - "allow_videogifs": true, - "user_flair_type": "text", - "allow_polls": true, - "collapse_deleted_comments": false, - "emojis_custom_size": null, - "public_description_html": "<!-- SC_OFF --><div class=\"md\"><p>This is a group for laughing at and mocking the awkward, ridiculous, and sometimes painful things we endure while trying for a baby. Trollingforababy is for people who are trying to conceive, and are not currently pregnant. </p>\n\n<p>Please look at our complete list of rules before participating.</p>\n</div><!-- SC_ON -->", - "allow_videos": true, - "is_crosspostable_subreddit": true, - "suggested_comment_sort": null, - "can_assign_link_flair": true, - "accounts_active_is_fuzzed": false, - "submit_text_label": "", - "link_flair_position": "left", - "user_sr_flair_enabled": null, - "user_flair_enabled_in_sr": false, - "allow_chat_post_creation": false, - "allow_discovery": true, - "user_sr_theme_enabled": true, - "link_flair_enabled": true, - "subreddit_type": "public", - "notification_level": null, - "banner_img": "", - "user_flair_text": null, - "banner_background_color": "", - "show_media": true, - "id": "333yu", - "user_is_contributor": false, - "over18": false, - "description": "&nbsp;\n\nThis is a group for laughing at and mocking the awkward, ridiculous, and sometimes painful things we endure while *trying* for a baby. Salt and bitterness allowed, infertility sucks and there are few havens that are available for venting the frustrations that go along with it. Trollingforababy is for people who are trying to conceive, and are not currently pregnant. |\n-------------------|\n\n&nbsp;\n\n**The Rules:**\n\n* Posts should be related to *trying* for a baby.\n\n* Trollingforababy is for people who are trying to conceive, and are not currently pregnant.\n\n* Posts should contain an image or gif, no text-only submissions. \n\n* No announcing or discussing BFPs (positive pregnancy tests). \n\n* No discussion of living children or pregnancies. \n\n* No gifs or images containing human babies, toddlers, or small children.\n\n* No gifs or images containing pregnant women.\n\n* No gifs or images that are graphic, bloody, or gruesome, especially in the context of miscarriage. These posts can be extremely triggering for our members, especially those who have experienced loss.\n\n* No posts or discussion of abortion, whether your own or someone else's. This rule is to avoid triggering content, but also to uphold others' rights to reproductive choice.\n\n* Be kind and respectful- excessively rude/derogatory comments will be removed.\n\n* We love gifs and trolling but there is a 2 post per 24 hour post limit (per user). \n\n* No throwaway accounts for posts or comments. \n\n* Please use the [NSFW] tag when appropriate. \n\n\n&nbsp;\n\nPlease report inappropriate content! We want this to be a safe space where we can laugh about trying for that elusive baby. While we are trollingforababy, we *do not* tolerate general trolls who mock sensitive reproductive subjects. We are pro ART, and are accepting of all reproductive journeys.|\n-------------------|\n\n\nThere is no such thing as TMI.|\n-------------------|\n\n\nIf you can't find the humor here, perhaps this is not for you.|\n-------------------|\n\n\nAcronym | Term \n-------------------|------------|\n2WW | [Two-Week Wait (post ovulation)]( https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_surviving_the_.22two-week_wait.22) | \nAF| [Aunt Flow (period)](https://en.wikipedia.org/wiki/Menstruation) |\nAI| [Artificial Insemination]( https://en.wikipedia.org/wiki/Artificial_insemination)|\nAMH | [Anti-Mullerian Hormone]( https://en.wikipedia.org/wiki/Anti-M%C3%BCllerian_hormone)| \nART| [Assisted Reproductive Technology]( https://en.wikipedia.org/wiki/Assisted_reproductive_technology)| \nBBT | [Basal Body Temperature]( https://www.reddit.com/r/tryingforababy/wiki/temping) | \nBCP | [Birth Control Pills ](https://en.wikipedia.org/wiki/Oral_contraceptive_pill)\nBCW| Birth Control Withdrawal|\nBFN| Big Fat Negative| \nBFP| Big Fat Positive | \nCD| [Cycle Day](https://en.wikipedia.org/wiki/Menstrual_cycle)| \nCM | [Cervical Mucus]( https://www.reddit.com/r/tryingforababy/wiki/cm)| \nCP| [Chemical Pregnancy]( https://www.reddit.com/r/TryingForABaby/comments/7j53u1/chemical_pregnancy_info_post_tw_for_discussion_of/)|\nD&C| [Dilation & Curettage]( https://en.wikipedia.org/wiki/Dilation_and_curettage)| \nDNLTYD| Do Not Lie To Your Doctor\nDPO| [Days Post-Ovulation](https://en.wikipedia.org/wiki/Menstrual_cycle)| \nDS | [Donor Sperm]( https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_sperm_donation)|\nENDO| [Endometriosis]( https://en.wikipedia.org/wiki/Endometriosis)| \nEOD| Every Other Day|\nEWCM| Egg White Cervical Mucus|\nEP| [Ectopic Pregnancy]( https://en.wikipedia.org/wiki/Ectopic_pregnancy)\nER| [Egg Retrieval]( https://en.wikipedia.org/wiki/Transvaginal_oocyte_retrieval) | \nET| [Embryo Transfer]( https://en.wikipedia.org/wiki/Embryo_transfer)| \nFET| [Frozen Embryo Transfer]( https://en.wikipedia.org/wiki/Embryo_transfer#Fresh_versus_frozen)| \nFF| [FertilityFriend.com]( https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_any_recommended_apps.3F)\nFMU| [First Morning Urine] (http://www.early-pregnancy-tests.com/firstmorningurine.html) | \nFP| [Follicular Phase]( https://en.wikipedia.org/wiki/Follicular_phase)| \nFRER| First Response Early Result pregnancy test| \nFW| Fertile Window|\nGP| [General Practitioner]( https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_gp) or Gestating Partner\nGS| [Gestational Surrogate](https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_gestational_carrier_.28surrogacy.29) |\nHBC| [Hormonal Birth Control](https://en.wikipedia.org/wiki/Hormonal_contraception)\nHCG | [Human Chorionic Gonadotropin]( https://en.wikipedia.org/wiki/Human_chorionic_gonadotropin)| \nHPT | [Home Pregnancy Test ]( https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_when_to_use_a_pregnancy_test_.28hpt.29)\nHSC| [HysteroSCopy ]( https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_hysteroscopy)\nHSG| [HysteroSalpingoGram]( https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_hsg) | \nIBIAM| Implantation Bleeding is a Myth\nICI| [Intracervical Insemination]( https://en.wikipedia.org/wiki/Artificial_insemination#Intracervical_insemination)\nICSI | [Intra-Cytoplasmic Sperm Injection]( https://www.reddit.com/r/infertility/comments/8tubh8/faq_tell_me_about_intracytoplasmic_sperm/ )| \nIF | Infertility \nIJP| It’s Just Progesterone\nIKMTMD| I Know More Than My Doctor\nIM| [Intra-Muscular Injection]( https://en.wikipedia.org/wiki/Intramuscular_injection)| \nIUI| [Intra-Uterine Insemination]( https://www.reddit.com/r/infertility/comments/1zxhu7/faqtell_me_about_your_iui/) | \nIVF | [In Vitro Fertilization]( https://www.reddit.com/r/infertility/comments/1zxhwh/faqtell_me_about_your_ivf/ )| \nLAP| [Laparoscopy]( https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_laparoscopy)| \nLH| [Luteinizing Hormone]( https://en.wikipedia.org/wiki/Luteinizing_hormone)\nLMP | Last Menstrual Period| \nLO| Little One (children)| \nLP| [Luteal Phase]( https://en.wikipedia.org/wiki/Luteal_phase )| \nLPD| [Luteal Phase Defect]( https://en.wikipedia.org/wiki/Luteal_phase#Luteal_phase_defect )| \nMC, M/C, MISC | [Miscarriage]( https://en.wikipedia.org/wiki/Miscarriage) | \nMMC| [Missed Miscarriage]( https://en.wikipedia.org/wiki/Miscarriage#missed )|\nMF or MFI| [Male Factor Infertility]( https://en.wikipedia.org/wiki/Male_infertility )| \nMRKH| [Mayer-Rokitansky-Kuster-Hauser syndrome]( https://en.wikipedia.org/wiki/M%C3%BCllerian_agenesis )| \nNCCWPI| Normal Coffee Consumption Won’t Prevent Implantation|\nNGP|Non-Gestating Partner|\nNOWTSYC1BFPPL| No One Wants to See Your Cycle 1 BFP Please Leave\nNTNP| [Not Trying, Not Preventing]( https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_ntnp)|\nO, OV| [Ovulation]( https://en.wikipedia.org/wiki/Ovulation )| \nOB/GYN, OBGYN| [Obstetrician/Gynecologist ]( https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_obgyn)\nOHSS| [Ovarian HyperStimulation Sydrome](https://en.wikipedia.org/wiki/Ovarian_hyperstimulation_syndrome)| \nOPK| [Ovulation Predictor Kit or Test]( https://www.reddit.com/r/tryingforababy/wiki/opks)| \nOTMN| One Temp Means Nothing|\nPCO and PCOS| [PolyCystic Ovar(ies) and PolyCystic Ovary Syndrome]( https://en.wikipedia.org/wiki/Polycystic_ovary_syndrome )| \nPCP| Primary Care Physician \nPFIIMUB| Pineapple for Implantation is Made Up Bullshit\nPGD and PGS| [Pre-implantation Genetic Diagnosis]( https://www.reddit.com/r/infertility/comments/9gkyc6/faq_tell_me_about_pgd_testing/) and [Screening]( https://www.reddit.com/r/infertility/comments/21tzum/faqtell_me_about_pgs/ )| \nPIO| [Progesterone in Oil]( https://en.wikipedia.org/wiki/Pharmacology_of_progesterone#Intramuscular_injection )| \nPOAS| Pee On a Stick| \nRE| [Reproductive Endocrinologist ]( https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_re)\nRIVF| [Reciprocal IVF]( https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_reciprocal_ivf)\nRPL| [Recurrent Pregnancy Loss]( https://www.reddit.com/r/infertility/comments/1vs5cq/faqtell_me_about_rpl_recurrent_pregnancy_loss/) | \nSA| [Semen Analysis ]( https://www.reddit.com/r/tryingforababy/wiki/infertility#wiki_semen_analysis)\nSART| [Society of Assisted Reproductive Technology](https://www.sart.org/) \nSD| [Sperm Donor]( https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_sperm_donation )|\nSDCMC| Stress Doesn’t Cause Miscarriages|\nSHG| [SonoHysteroGram](https://en.wikipedia.org/wiki/Gynecologic_ultrasonography)| \nSMEP| [Sperm Meets Egg Plan](http://spermmeetseggplan.com/)|\nSTHM| Spearmint Tea Hail Mary|\nSubQ| [Subcutaneous Injection](https://en.wikipedia.org/wiki/Subcutaneous_injection)|\nTCOYF| [Taking Charge of Your Fertility]( https://www.amazon.com/gp/product/0062326031/)| \nTESA and TESE| [Testicular Sperm Aspiration and Testicular Sperm Extraction]( https://www.reddit.com/r/infertility/comments/8z0oni/faq_tell_me_about_tese_mtese/ )| \nTI| [Timed Intercourse]( https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_tracking )|\nTTC| [Trying to Conceive]( https://www.reddit.com/r/tryingforababy/wiki/newtottc )|\nTS| [Traditional Surrogacy]( https://www.reddit.com/r/TryingForABaby/wiki/lgbt#wiki_gestational_carrier_.28surrogacy.29)|\nTSH| [Thyroid Stimulating Hormone]( https://en.wikipedia.org/wiki/Thyroid-stimulating_hormone) |\nTW/CW| Trigger Warning or Content Warning|\nTWW| [Two-Week Wait (post ovulation)]( https://www.reddit.com/r/tryingforababy/wiki/newtottc#wiki_surviving_the_.22two-week_wait.22) |\nWROG| Well Read on Google \n\n\n**RELATED SUBREDDITS**|\n-------------------| \n\n/r/TryingForABaby\n\n/r/TFABChartStalkers\n\n/r/TFABLinePorn\n\n/r/TTCafterloss\n\n/r/StillTrying\n\n/r/Infertility\n\n/r/MaleInfertility\n\n/r/queerception\n\n/r/TTC_PCOS\n\n/r/TTC30\n\n/r/shittyfertilityadvice", - "is_chat_post_feature_enabled": true, - "submit_link_label": "", - "user_flair_text_color": null, - "restrict_commenting": false, - "user_flair_css_class": null, - "allow_images": true, - "lang": "en", - "whitelist_status": null, - "url": "/r/trollingforababy/", - "created_utc": 1408404587, - "banner_size": null, - "mobile_banner_image": "", - "user_is_moderator": false - } - } - ], - "before": null - } -} diff --git a/testdata/search/users.json b/testdata/search/users.json deleted file mode 100644 index e1d90f7..0000000 --- a/testdata/search/users.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "kind": "Listing", - "data": { - "after": "", - "dist": 2, - "facets": {}, - "modhash": null, - "children": [ - { - "kind": "t2", - "data": { - "is_employee": false, - "icon_img": "https://www.redditstatic.com/avatars/avatar_default_12_FF4500.png", - "pref_show_snoovatar": false, - "name": "user1", - "is_friend": false, - "created": 1565854722, - "has_subscribed": true, - "hide_from_robots": false, - "verified": true, - "created_utc": 1565825922, - "subreddit": { - "default_set": true, - "banner_img": "", - "restrict_posting": true, - "user_is_banned": false, - "free_form_reports": true, - "community_icon": null, - "show_media": true, - "description": "", - "user_is_muted": false, - "display_name": "u_user1", - "header_img": null, - "title": "", - "previous_names": [], - "user_is_moderator": false, - "over_18": false, - "icon_size": [256, 256], - "primary_color": "", - "icon_img": "https://www.redditstatic.com/avatars/avatar_default_12_FF4500.png", - "icon_color": "#FF4500", - "submit_link_label": "", - "header_size": null, - "restrict_commenting": false, - "subscribers": 0, - "submit_text_label": "", - "is_default_icon": true, - "link_flair_position": "", - "display_name_prefixed": "u/user1", - "key_color": "", - "name": "t5_sr1", - "is_default_banner": true, - "url": "/user/user1/", - "banner_size": null, - "user_is_contributor": false, - "public_description": "", - "link_flair_enabled": false, - "disable_contributor_requests": false, - "subreddit_type": "user", - "user_is_subscriber": false - }, - "comment_karma": 11740, - "is_gold": false, - "is_mod": true, - "accept_chats": false, - "link_karma": 5730, - "has_verified_email": true, - "id": "abc", - "accept_pms": true - } - }, - { - "kind": "t2", - "data": { - "is_employee": false, - "icon_img": "https://www.redditstatic.com/avatars/avatar_default_16_FF585B.png", - "pref_show_snoovatar": false, - "name": "user2", - "is_friend": false, - "created": 1588850206, - "has_subscribed": true, - "hide_from_robots": true, - "verified": true, - "created_utc": 1588821406, - "subreddit": { - "default_set": true, - "banner_img": "", - "restrict_posting": true, - "user_is_banned": false, - "free_form_reports": true, - "community_icon": null, - "show_media": true, - "description": "", - "user_is_muted": false, - "display_name": "u_user2", - "header_img": null, - "title": "", - "previous_names": [], - "user_is_moderator": false, - "over_18": true, - "icon_size": [256, 256], - "primary_color": "", - "icon_img": "https://www.redditstatic.com/avatars/avatar_default_16_FF585B.png", - "icon_color": "#FF585B", - "submit_link_label": "", - "header_size": null, - "restrict_commenting": false, - "subscribers": 0, - "submit_text_label": "", - "is_default_icon": true, - "link_flair_position": "", - "display_name_prefixed": "u/user2", - "key_color": "", - "name": "t5_sr2", - "is_default_banner": true, - "url": "/user/user2/", - "banner_size": null, - "user_is_contributor": false, - "public_description": "", - "link_flair_enabled": false, - "disable_contributor_requests": false, - "subreddit_type": "user", - "user_is_subscriber": false - }, - "comment_karma": 127, - "is_gold": false, - "is_mod": false, - "accept_chats": false, - "link_karma": 2485, - "has_verified_email": false, - "id": "def", - "accept_pms": true - } - } - ], - "before": null - } -} diff --git a/testdata/search/posts.json b/testdata/subreddit/search-posts.json similarity index 100% rename from testdata/search/posts.json rename to testdata/subreddit/search-posts.json diff --git a/user_test.go b/user_test.go index a674189..b9c62c4 100644 --- a/user_test.go +++ b/user_test.go @@ -160,7 +160,7 @@ var expectedUserSubreddits = &Subreddits{ After: "t5_3knn1", } -var expectedSearchUsers2 = &Users{ +var expectedSearchUsers = &Users{ Users: []*User{ { ID: "179965", @@ -943,5 +943,5 @@ func TestUserService_Search(t *testing.T) { users, _, err := client.User.Search(ctx, "test") assert.NoError(t, err) - assert.Equal(t, expectedSearchUsers2, users) + assert.Equal(t, expectedSearchUsers, users) }