From fe8a1f5d375aebcccac6e986862568b0a1950682 Mon Sep 17 00:00:00 2001 From: Daniil Suvorov Date: Thu, 22 Feb 2024 19:53:10 +0300 Subject: [PATCH] style: update golangci-lint to 1.56.2 (#278) --- .github/workflows/golangci-lint.yml | 4 +- .golangci.yml | 23 + api/api.go | 1 + api/api_test.go | 12 +- api/apps_test.go | 2 +- api/errors.go | 14 +- api/oauth/group_test.go | 4 +- api/oauth/user_test.go | 4 +- api/params/account_test.go | 102 ++--- api/params/ads_test.go | 234 +++++----- api/params/appWidgets_test.go | 4 +- api/params/apps_test.go | 88 ++-- api/params/auth_test.go | 28 +- api/params/board_test.go | 104 ++--- api/params/calls_test.go | 4 +- api/params/database_test.go | 74 ++-- api/params/docs_test.go | 52 +-- api/params/donut_test.go | 18 +- api/params/downloadedGames_test.go | 2 +- api/params/fave_test.go | 102 ++--- api/params/friends_test.go | 124 +++--- api/params/gifts_test.go | 6 +- api/params/groups_test.go | 634 ++++++++++++++-------------- api/params/leads_test.go | 52 +-- api/params/likes_test.go | 44 +- api/params/market_test.go | 288 ++++++------- api/params/marusia_test.go | 12 +- api/params/messages_test.go | 356 ++++++++-------- api/params/newsfeed_test.go | 132 +++--- api/params/notes_test.go | 70 +-- api/params/notifications_test.go | 20 +- api/params/orders_test.go | 42 +- api/params/pages_test.go | 56 +-- api/params/photos_test.go | 400 +++++++++--------- api/params/polls_test.go | 82 ++-- api/params/prettyCards_test.go | 44 +- api/params/search_test.go | 12 +- api/params/secure_test.go | 54 +-- api/params/stats_test.go | 24 +- api/params/status_test.go | 8 +- api/params/storage_test.go | 24 +- api/params/stories_test.go | 90 ++-- api/params/streaming_test.go | 2 +- api/params/users_test.go | 100 ++--- api/params/utils_test.go | 26 +- api/params/video_test.go | 272 ++++++------ api/params/wall_test.go | 268 ++++++------ api/params/widgets_test.go | 24 +- api/storage_test.go | 2 +- api/upload.go | 114 ++--- api/wall_test.go | 3 +- callback/context_test.go | 4 +- callback/setting.go | 12 +- callback/setting_test.go | 11 +- events/events_test.go | 218 +++++----- games/verify_test.go | 2 +- internal/transport_test.go | 4 +- longpoll-bot/longpoll_test.go | 6 +- longpoll-user/longpoll.go | 8 +- longpoll-user/v3/wrapper_test.go | 35 +- marusia/skill_test.go | 5 +- marusia/webhook_test.go | 8 +- object/groups.go | 4 +- object/messages_test.go | 44 +- object/object_test.go | 7 +- payments/callback_test.go | 16 +- streaming/streaming.go | 1 + streaming/streaming_test.go | 4 +- vkapps/params_test.go | 6 +- vkapps/verify_test.go | 2 +- 70 files changed, 2343 insertions(+), 2315 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 6e6f627d..2b3ca2a2 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,6 +13,6 @@ jobs: go-version: 1.* - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: - version: v1.51 + version: v1.56.2 diff --git a/.golangci.yml b/.golangci.yml index 8db41072..db7d89f6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -67,6 +67,19 @@ linters: - gocheckcompilerdirectives - asasalint + - musttag + + - gosmopolitan + - mirror + - tagalign + + - gochecksumtype + - inamedparam + - perfsprint + - sloglint + - testifylint + + # - musttag # TODO: need update golangci-lint # - wrapcheck # TODO: v3 Fix # - testpackage # TODO: Fix testpackage @@ -106,6 +119,10 @@ linters: # - ginkgolinter +# - zerologlint +# - protogetter +# - spancheck + # depricated # - maligned # - interfacer @@ -138,3 +155,9 @@ issues: text: "G307:" exclude-use-default: false + +linters-settings: + testifylint: + enable-all: true + disable: + - require-error # f func false positive diff --git a/api/api.go b/api/api.go index 47acd445..26ea9816 100644 --- a/api/api.go +++ b/api/api.go @@ -241,6 +241,7 @@ func (vk *VK) DefaultHandler(method string, sliceParams ...Params) (Response, er vk.lastTime = time.Now() vk.rps = 0 } + vk.rps++ vk.mux.Unlock() diff --git a/api/api_test.go b/api/api_test.go index 0c60cfca..366bdbe9 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -254,7 +254,7 @@ func Test_FmtValue(t *testing.T) { t.Helper() got := api.FmtValue(value, 0) - assert.Equal(t, got, want) + assert.Equal(t, want, got) } f(nil, "") @@ -301,11 +301,11 @@ func TestParams_methods(t *testing.T) { p.CaptchaKey("text") p.Confirm(true) - assert.Equal(t, p["lang"], 1) - assert.Equal(t, p["test_mode"], true) - assert.Equal(t, p["captcha_sid"], "text") - assert.Equal(t, p["captcha_key"], "text") - assert.Equal(t, p["confirm"], true) + assert.Equal(t, 1, p["lang"]) + assert.Equal(t, true, p["test_mode"]) + assert.Equal(t, "text", p["captcha_sid"]) + assert.Equal(t, "text", p["captcha_key"]) + assert.Equal(t, true, p["confirm"]) } func TestContext(t *testing.T) { diff --git a/api/apps_test.go b/api/apps_test.go index bf1f4763..81e31a71 100644 --- a/api/apps_test.go +++ b/api/apps_test.go @@ -15,7 +15,7 @@ func TestVK_AppsDeleteAppRequests(t *testing.T) { res, err := vkUser.AppsDeleteAppRequests(nil) noError(t, err) - assert.Equal(t, res, 1) + assert.Equal(t, 1, res) } func TestVK_AppsGet(t *testing.T) { diff --git a/api/errors.go b/api/errors.go index 7ad0c9f7..9397ee90 100644 --- a/api/errors.go +++ b/api/errors.go @@ -7,12 +7,14 @@ import ( "github.com/SevereCloud/vksdk/v2/object" ) +const errorMessagePrefix = "api: " + // ErrorType is the type of an error. type ErrorType int // Error returns the message of a ErrorType. func (e ErrorType) Error() string { - return fmt.Sprintf("api: error with code %d", e) + return fmt.Sprintf(errorMessagePrefix+"error with code %d", e) } // Error codes. See https://vk.com/dev/errors @@ -850,7 +852,7 @@ type ErrorSubtype int // Error returns the message of a ErrorSubtype. func (e ErrorSubtype) Error() string { - return fmt.Sprintf("api: error with subcode %d", e) + return fmt.Sprintf(errorMessagePrefix+"error with subcode %d", e) } // Error struct VK. @@ -917,7 +919,7 @@ type Error struct { // Error returns the message of a Error. func (e Error) Error() string { - return "api: " + e.Message + return errorMessagePrefix + e.Message } // Is unwraps its first argument sequentially looking for an error that matches @@ -974,7 +976,7 @@ type UploadError struct { // Error returns the message of a UploadError. func (e UploadError) Error() string { if e.Err != "" { - return "api: " + e.Err + return errorMessagePrefix + e.Err } return fmt.Sprintf("api: upload code %d", e.Code) @@ -988,7 +990,7 @@ type AdsError struct { // Error returns the message of a AdsError. func (e AdsError) Error() string { - return "api: " + e.Desc + return errorMessagePrefix + e.Desc } // Is unwraps its first argument sequentially looking for an error that matches @@ -1016,7 +1018,7 @@ type AuthSilentTokenError struct { // Error returns the description of a AuthSilentTokenError. func (e AuthSilentTokenError) Error() string { - return "api: " + e.Description + return errorMessagePrefix + e.Description } // Is unwraps its first argument sequentially looking for an error that matches diff --git a/api/oauth/group_test.go b/api/oauth/group_test.go index 6602bb79..a5efedd6 100644 --- a/api/oauth/group_test.go +++ b/api/oauth/group_test.go @@ -20,7 +20,7 @@ func TestNewGroupTokensFromJSON(t *testing.T) { assert.EqualError(t, err, wantErr) } - assert.Equal(t, token, wantToken) + assert.Equal(t, wantToken, token) } f([]byte("123"), nil, "json: cannot unmarshal number into Go value of type oauth.Error") @@ -57,7 +57,7 @@ func TestNewGroupTokensFromURL(t *testing.T) { assert.EqualError(t, err, wantErr) } - assert.Equal(t, token, wantToken) + assert.Equal(t, wantToken, token) } f( diff --git a/api/oauth/user_test.go b/api/oauth/user_test.go index e68f0f0b..ee97479b 100644 --- a/api/oauth/user_test.go +++ b/api/oauth/user_test.go @@ -18,7 +18,7 @@ func TestParseJSON(t *testing.T) { assert.EqualError(t, err, wantErr) } - assert.Equal(t, token, wantToken) + assert.Equal(t, wantToken, token) } f([]byte("123"), nil, "json: cannot unmarshal number into Go value of type oauth.Error") @@ -51,7 +51,7 @@ func TestParseURL(t *testing.T) { assert.EqualError(t, err, wantErr) } - assert.Equal(t, token, wantToken) + assert.Equal(t, wantToken, token) } f( diff --git a/api/params/account_test.go b/api/params/account_test.go index 6d9732b4..7c6b96a7 100644 --- a/api/params/account_test.go +++ b/api/params/account_test.go @@ -14,7 +14,7 @@ func TestAccountBanBuilder(t *testing.T) { b.OwnerID(1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestAccountChangePasswordBuilder(t *testing.T) { @@ -27,10 +27,10 @@ func TestAccountChangePasswordBuilder(t *testing.T) { b.OldPassword("text") b.NewPassword("text") - assert.Equal(t, b.Params["restore_sid"], "text") - assert.Equal(t, b.Params["change_password_hash"], "text") - assert.Equal(t, b.Params["old_password"], "text") - assert.Equal(t, b.Params["new_password"], "text") + assert.Equal(t, "text", b.Params["restore_sid"]) + assert.Equal(t, "text", b.Params["change_password_hash"]) + assert.Equal(t, "text", b.Params["old_password"]) + assert.Equal(t, "text", b.Params["new_password"]) } func TestAccountGetActiveOffersBuilder(t *testing.T) { @@ -41,8 +41,8 @@ func TestAccountGetActiveOffersBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestAccountGetAppPermissionsBuilder(t *testing.T) { @@ -52,7 +52,7 @@ func TestAccountGetAppPermissionsBuilder(t *testing.T) { b.UserID(1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) } func TestAccountGetBannedBuilder(t *testing.T) { @@ -63,8 +63,8 @@ func TestAccountGetBannedBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestAccountGetCountersBuilder(t *testing.T) { @@ -75,8 +75,8 @@ func TestAccountGetCountersBuilder(t *testing.T) { b.Filter([]string{"text"}) b.UserID(1) - assert.Equal(t, b.Params["filter"], []string{"text"}) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, []string{"text"}, b.Params["filter"]) + assert.Equal(t, 1, b.Params["user_id"]) } func TestAccountGetInfoBuilder(t *testing.T) { @@ -86,7 +86,7 @@ func TestAccountGetInfoBuilder(t *testing.T) { b.Fields([]string{"text"}) - assert.Equal(t, b.Params["fields"], []string{"text"}) + assert.Equal(t, []string{"text"}, b.Params["fields"]) } func TestAccountGetPushSettingsBuilder(t *testing.T) { @@ -96,7 +96,7 @@ func TestAccountGetPushSettingsBuilder(t *testing.T) { b.DeviceID("text") - assert.Equal(t, b.Params["device_id"], "text") + assert.Equal(t, "text", b.Params["device_id"]) } func TestAccountRegisterDeviceBuilder(t *testing.T) { @@ -112,13 +112,13 @@ func TestAccountRegisterDeviceBuilder(t *testing.T) { b.Settings("text") b.Sandbox(true) - assert.Equal(t, b.Params["token"], "text") - assert.Equal(t, b.Params["device_model"], "text") - assert.Equal(t, b.Params["device_year"], 1) - assert.Equal(t, b.Params["device_id"], "text") - assert.Equal(t, b.Params["system_version"], "text") - assert.Equal(t, b.Params["settings"], "text") - assert.Equal(t, b.Params["sandbox"], true) + assert.Equal(t, "text", b.Params["token"]) + assert.Equal(t, "text", b.Params["device_model"]) + assert.Equal(t, 1, b.Params["device_year"]) + assert.Equal(t, "text", b.Params["device_id"]) + assert.Equal(t, "text", b.Params["system_version"]) + assert.Equal(t, "text", b.Params["settings"]) + assert.Equal(t, true, b.Params["sandbox"]) } func TestAccountSaveProfileInfoBuilder(t *testing.T) { @@ -141,20 +141,20 @@ func TestAccountSaveProfileInfoBuilder(t *testing.T) { b.CityID(1) b.Status("text") - assert.Equal(t, b.Params["first_name"], "text") - assert.Equal(t, b.Params["last_name"], "text") - assert.Equal(t, b.Params["maiden_name"], "text") - assert.Equal(t, b.Params["screen_name"], "text") - assert.Equal(t, b.Params["cancel_request_id"], 1) - assert.Equal(t, b.Params["sex"], 1) - assert.Equal(t, b.Params["relation"], 1) - assert.Equal(t, b.Params["relation_partner_id"], 1) - assert.Equal(t, b.Params["bdate"], "text") - assert.Equal(t, b.Params["bdate_visibility"], 1) - assert.Equal(t, b.Params["home_town"], "text") - assert.Equal(t, b.Params["country_id"], 1) - assert.Equal(t, b.Params["city_id"], 1) - assert.Equal(t, b.Params["status"], "text") + assert.Equal(t, "text", b.Params["first_name"]) + assert.Equal(t, "text", b.Params["last_name"]) + assert.Equal(t, "text", b.Params["maiden_name"]) + assert.Equal(t, "text", b.Params["screen_name"]) + assert.Equal(t, 1, b.Params["cancel_request_id"]) + assert.Equal(t, 1, b.Params["sex"]) + assert.Equal(t, 1, b.Params["relation"]) + assert.Equal(t, 1, b.Params["relation_partner_id"]) + assert.Equal(t, "text", b.Params["bdate"]) + assert.Equal(t, 1, b.Params["bdate_visibility"]) + assert.Equal(t, "text", b.Params["home_town"]) + assert.Equal(t, 1, b.Params["country_id"]) + assert.Equal(t, 1, b.Params["city_id"]) + assert.Equal(t, "text", b.Params["status"]) } func TestAccountSetInfoBuilder(t *testing.T) { @@ -165,8 +165,8 @@ func TestAccountSetInfoBuilder(t *testing.T) { b.Name("text") b.Value("text") - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["value"], "text") + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["value"]) } func TestAccountSetNameInMenuBuilder(t *testing.T) { @@ -177,8 +177,8 @@ func TestAccountSetNameInMenuBuilder(t *testing.T) { b.UserID(1) b.Name("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["name"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["name"]) } func TestAccountSetOnlineBuilder(t *testing.T) { @@ -188,7 +188,7 @@ func TestAccountSetOnlineBuilder(t *testing.T) { b.Voip(true) - assert.Equal(t, b.Params["voip"], true) + assert.Equal(t, true, b.Params["voip"]) } func TestAccountSetPushSettingsBuilder(t *testing.T) { @@ -201,10 +201,10 @@ func TestAccountSetPushSettingsBuilder(t *testing.T) { b.Key("text") b.Value([]string{"text"}) - assert.Equal(t, b.Params["device_id"], "text") - assert.Equal(t, b.Params["settings"], "text") - assert.Equal(t, b.Params["key"], "text") - assert.Equal(t, b.Params["value"], []string{"text"}) + assert.Equal(t, "text", b.Params["device_id"]) + assert.Equal(t, "text", b.Params["settings"]) + assert.Equal(t, "text", b.Params["key"]) + assert.Equal(t, []string{"text"}, b.Params["value"]) } func TestAccountSetSilenceModeBuilder(t *testing.T) { @@ -217,10 +217,10 @@ func TestAccountSetSilenceModeBuilder(t *testing.T) { b.PeerID(1) b.Sound(1) - assert.Equal(t, b.Params["device_id"], "text") - assert.Equal(t, b.Params["time"], 1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["sound"], 1) + assert.Equal(t, "text", b.Params["device_id"]) + assert.Equal(t, 1, b.Params["time"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["sound"]) } func TestAccountUnbanBuilder(t *testing.T) { @@ -230,7 +230,7 @@ func TestAccountUnbanBuilder(t *testing.T) { b.OwnerID(1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestAccountUnregisterDeviceBuilder(t *testing.T) { @@ -241,6 +241,6 @@ func TestAccountUnregisterDeviceBuilder(t *testing.T) { b.DeviceID("text") b.Sandbox(true) - assert.Equal(t, b.Params["device_id"], "text") - assert.Equal(t, b.Params["sandbox"], true) + assert.Equal(t, "text", b.Params["device_id"]) + assert.Equal(t, true, b.Params["sandbox"]) } diff --git a/api/params/ads_test.go b/api/params/ads_test.go index e07d7492..6ec2b71d 100644 --- a/api/params/ads_test.go +++ b/api/params/ads_test.go @@ -15,8 +15,8 @@ func TestAdsAddOfficeUsersBuilder(t *testing.T) { b.AccountID(1) b.Data("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["data"]) } func TestAdsCheckLinkBuilder(t *testing.T) { @@ -29,10 +29,10 @@ func TestAdsCheckLinkBuilder(t *testing.T) { b.LinkURL("text") b.CampaignID(1) - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["link_type"], "text") - assert.Equal(t, b.Params["link_url"], "text") - assert.Equal(t, b.Params["campaign_id"], 1) + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["link_type"]) + assert.Equal(t, "text", b.Params["link_url"]) + assert.Equal(t, 1, b.Params["campaign_id"]) } func TestAdsCreateAdsBuilder(t *testing.T) { @@ -43,8 +43,8 @@ func TestAdsCreateAdsBuilder(t *testing.T) { b.AccountID(1) b.Data("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["data"]) } func TestAdsCreateCampaignsBuilder(t *testing.T) { @@ -55,8 +55,8 @@ func TestAdsCreateCampaignsBuilder(t *testing.T) { b.AccountID(1) b.Data("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["data"]) } func TestAdsCreateClientsBuilder(t *testing.T) { @@ -67,8 +67,8 @@ func TestAdsCreateClientsBuilder(t *testing.T) { b.AccountID(1) b.Data("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["data"]) } func TestAdsCreateTargetGroupBuilder(t *testing.T) { @@ -83,12 +83,12 @@ func TestAdsCreateTargetGroupBuilder(t *testing.T) { b.TargetPixelID(1) b.TargetPixelRules("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["lifetime"], 1) - assert.Equal(t, b.Params["target_pixel_id"], 1) - assert.Equal(t, b.Params["target_pixel_rules"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, 1, b.Params["lifetime"]) + assert.Equal(t, 1, b.Params["target_pixel_id"]) + assert.Equal(t, "text", b.Params["target_pixel_rules"]) } func TestAdsDeleteAdsBuilder(t *testing.T) { @@ -99,8 +99,8 @@ func TestAdsDeleteAdsBuilder(t *testing.T) { b.AccountID(1) b.IDs("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ids"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ids"]) } func TestAdsDeleteCampaignsBuilder(t *testing.T) { @@ -111,8 +111,8 @@ func TestAdsDeleteCampaignsBuilder(t *testing.T) { b.AccountID(1) b.IDs("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ids"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ids"]) } func TestAdsDeleteClientsBuilder(t *testing.T) { @@ -123,8 +123,8 @@ func TestAdsDeleteClientsBuilder(t *testing.T) { b.AccountID(1) b.IDs("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ids"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ids"]) } func TestAdsDeleteTargetGroupBuilder(t *testing.T) { @@ -136,9 +136,9 @@ func TestAdsDeleteTargetGroupBuilder(t *testing.T) { b.ClientID(1) b.TargetGroupID(1) - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["target_group_id"], 1) + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, 1, b.Params["target_group_id"]) } func TestAdsGetAdsBuilder(t *testing.T) { @@ -154,13 +154,13 @@ func TestAdsGetAdsBuilder(t *testing.T) { b.Limit(1) b.Offset(1) - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ad_ids"], "text") - assert.Equal(t, b.Params["campaign_ids"], "text") - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["include_deleted"], true) - assert.Equal(t, b.Params["limit"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ad_ids"]) + assert.Equal(t, "text", b.Params["campaign_ids"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, true, b.Params["include_deleted"]) + assert.Equal(t, 1, b.Params["limit"]) + assert.Equal(t, 1, b.Params["offset"]) } func TestAdsGetAdsLayoutBuilder(t *testing.T) { @@ -176,13 +176,13 @@ func TestAdsGetAdsLayoutBuilder(t *testing.T) { b.Limit(1) b.Offset(1) - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ad_ids"], "text") - assert.Equal(t, b.Params["campaign_ids"], "text") - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["include_deleted"], true) - assert.Equal(t, b.Params["limit"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ad_ids"]) + assert.Equal(t, "text", b.Params["campaign_ids"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, true, b.Params["include_deleted"]) + assert.Equal(t, 1, b.Params["limit"]) + assert.Equal(t, 1, b.Params["offset"]) } func TestAdsGetAdsTargetingBuilder(t *testing.T) { @@ -199,14 +199,14 @@ func TestAdsGetAdsTargetingBuilder(t *testing.T) { b.Offset(1) b.OnlyDeleted(true) - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ad_ids"], "text") - assert.Equal(t, b.Params["campaign_ids"], "text") - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["include_deleted"], true) - assert.Equal(t, b.Params["limit"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["only_deleted"], true) + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ad_ids"]) + assert.Equal(t, "text", b.Params["campaign_ids"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, true, b.Params["include_deleted"]) + assert.Equal(t, 1, b.Params["limit"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, true, b.Params["only_deleted"]) } func TestAdsGetBudgetBuilder(t *testing.T) { @@ -216,7 +216,7 @@ func TestAdsGetBudgetBuilder(t *testing.T) { b.AccountID(1) - assert.Equal(t, b.Params["account_id"], 1) + assert.Equal(t, 1, b.Params["account_id"]) } func TestAdsGetCampaignsBuilder(t *testing.T) { @@ -229,10 +229,10 @@ func TestAdsGetCampaignsBuilder(t *testing.T) { b.IncludeDeleted(true) b.CampaignIDs("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["include_deleted"], true) - assert.Equal(t, b.Params["campaign_ids"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, true, b.Params["include_deleted"]) + assert.Equal(t, "text", b.Params["campaign_ids"]) } func TestAdsGetCategoriesBuilder(t *testing.T) { @@ -242,7 +242,7 @@ func TestAdsGetCategoriesBuilder(t *testing.T) { b.Lang("text") - assert.Equal(t, b.Params["lang"], "text") + assert.Equal(t, "text", b.Params["lang"]) } func TestAdsGetClientsBuilder(t *testing.T) { @@ -252,7 +252,7 @@ func TestAdsGetClientsBuilder(t *testing.T) { b.AccountID(1) - assert.Equal(t, b.Params["account_id"], 1) + assert.Equal(t, 1, b.Params["account_id"]) } func TestAdsGetDemographicsBuilder(t *testing.T) { @@ -267,12 +267,12 @@ func TestAdsGetDemographicsBuilder(t *testing.T) { b.DateFrom("text") b.DateTo("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ids_type"], "text") - assert.Equal(t, b.Params["ids"], "text") - assert.Equal(t, b.Params["period"], "text") - assert.Equal(t, b.Params["date_from"], "text") - assert.Equal(t, b.Params["date_to"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ids_type"]) + assert.Equal(t, "text", b.Params["ids"]) + assert.Equal(t, "text", b.Params["period"]) + assert.Equal(t, "text", b.Params["date_from"]) + assert.Equal(t, "text", b.Params["date_to"]) } func TestAdsGetFloodStatsBuilder(t *testing.T) { @@ -282,7 +282,7 @@ func TestAdsGetFloodStatsBuilder(t *testing.T) { b.AccountID(1) - assert.Equal(t, b.Params["account_id"], 1) + assert.Equal(t, 1, b.Params["account_id"]) } func TestAdsGetMusiciansBuilder(t *testing.T) { @@ -292,7 +292,7 @@ func TestAdsGetMusiciansBuilder(t *testing.T) { b.ArtistName("text") - assert.Equal(t, b.Params["artist_name"], "text") + assert.Equal(t, "text", b.Params["artist_name"]) } func TestAdsGetOfficeUsersBuilder(t *testing.T) { @@ -302,7 +302,7 @@ func TestAdsGetOfficeUsersBuilder(t *testing.T) { b.AccountID(1) - assert.Equal(t, b.Params["account_id"], 1) + assert.Equal(t, 1, b.Params["account_id"]) } func TestAdsGetPostsReachBuilder(t *testing.T) { @@ -314,9 +314,9 @@ func TestAdsGetPostsReachBuilder(t *testing.T) { b.IDsType("text") b.IDs("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ids_type"], "text") - assert.Equal(t, b.Params["ids"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ids_type"]) + assert.Equal(t, "text", b.Params["ids"]) } func TestAdsGetRejectionReasonBuilder(t *testing.T) { @@ -327,8 +327,8 @@ func TestAdsGetRejectionReasonBuilder(t *testing.T) { b.AccountID(1) b.AdID(1) - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ad_id"], 1) + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["ad_id"]) } func TestAdsGetStatisticsBuilder(t *testing.T) { @@ -343,12 +343,12 @@ func TestAdsGetStatisticsBuilder(t *testing.T) { b.DateFrom("text") b.DateTo("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ids_type"], "text") - assert.Equal(t, b.Params["ids"], "text") - assert.Equal(t, b.Params["period"], "text") - assert.Equal(t, b.Params["date_from"], "text") - assert.Equal(t, b.Params["date_to"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ids_type"]) + assert.Equal(t, "text", b.Params["ids"]) + assert.Equal(t, "text", b.Params["period"]) + assert.Equal(t, "text", b.Params["date_from"]) + assert.Equal(t, "text", b.Params["date_to"]) } func TestAdsGetSuggestionsBuilder(t *testing.T) { @@ -363,12 +363,12 @@ func TestAdsGetSuggestionsBuilder(t *testing.T) { b.Cities("text") b.Lang("text") - assert.Equal(t, b.Params["section"], "text") - assert.Equal(t, b.Params["ids"], "text") - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["country"], 1) - assert.Equal(t, b.Params["cities"], "text") - assert.Equal(t, b.Params["lang"], "text") + assert.Equal(t, "text", b.Params["section"]) + assert.Equal(t, "text", b.Params["ids"]) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["country"]) + assert.Equal(t, "text", b.Params["cities"]) + assert.Equal(t, "text", b.Params["lang"]) } func TestAdsGetTargetGroupsBuilder(t *testing.T) { @@ -380,9 +380,9 @@ func TestAdsGetTargetGroupsBuilder(t *testing.T) { b.ClientID(1) b.Extended(true) - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, true, b.Params["extended"]) } func TestAdsGetTargetingStatsBuilder(t *testing.T) { @@ -401,16 +401,16 @@ func TestAdsGetTargetingStatsBuilder(t *testing.T) { b.LinkURL("text") b.LinkDomain("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["criteria"], "text") - assert.Equal(t, b.Params["ad_id"], 1) - assert.Equal(t, b.Params["ad_format"], 1) - assert.Equal(t, b.Params["ad_platform"], "text") - assert.Equal(t, b.Params["ad_platform_no_wall"], "text") - assert.Equal(t, b.Params["ad_platform_no_ad_network"], "text") - assert.Equal(t, b.Params["link_url"], "text") - assert.Equal(t, b.Params["link_domain"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, "text", b.Params["criteria"]) + assert.Equal(t, 1, b.Params["ad_id"]) + assert.Equal(t, 1, b.Params["ad_format"]) + assert.Equal(t, "text", b.Params["ad_platform"]) + assert.Equal(t, "text", b.Params["ad_platform_no_wall"]) + assert.Equal(t, "text", b.Params["ad_platform_no_ad_network"]) + assert.Equal(t, "text", b.Params["link_url"]) + assert.Equal(t, "text", b.Params["link_domain"]) } func TestAdsGetUploadURLBuilder(t *testing.T) { @@ -421,8 +421,8 @@ func TestAdsGetUploadURLBuilder(t *testing.T) { b.AdFormat(1) b.Icon(1) - assert.Equal(t, b.Params["ad_format"], 1) - assert.Equal(t, b.Params["icon"], 1) + assert.Equal(t, 1, b.Params["ad_format"]) + assert.Equal(t, 1, b.Params["icon"]) } func TestAdsImportTargetContactsBuilder(t *testing.T) { @@ -435,10 +435,10 @@ func TestAdsImportTargetContactsBuilder(t *testing.T) { b.TargetGroupID(1) b.Contacts("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["target_group_id"], 1) - assert.Equal(t, b.Params["contacts"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, 1, b.Params["target_group_id"]) + assert.Equal(t, "text", b.Params["contacts"]) } func TestAdsRemoveOfficeUsersBuilder(t *testing.T) { @@ -449,8 +449,8 @@ func TestAdsRemoveOfficeUsersBuilder(t *testing.T) { b.AccountID(1) b.IDs("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["ids"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["ids"]) } func TestAdsUpdateAdsBuilder(t *testing.T) { @@ -461,8 +461,8 @@ func TestAdsUpdateAdsBuilder(t *testing.T) { b.AccountID(1) b.Data("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["data"]) } func TestAdsUpdateCampaignsBuilder(t *testing.T) { @@ -473,8 +473,8 @@ func TestAdsUpdateCampaignsBuilder(t *testing.T) { b.AccountID(1) b.Data("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["data"]) } func TestAdsUpdateClientsBuilder(t *testing.T) { @@ -485,8 +485,8 @@ func TestAdsUpdateClientsBuilder(t *testing.T) { b.AccountID(1) b.Data("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, "text", b.Params["data"]) } func TestAdsUpdateTargetGroupBuilder(t *testing.T) { @@ -503,12 +503,12 @@ func TestAdsUpdateTargetGroupBuilder(t *testing.T) { b.TargetPixelID(1) b.TargetPixelRules("text") - assert.Equal(t, b.Params["account_id"], 1) - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["target_group_id"], 1) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["domain"], "text") - assert.Equal(t, b.Params["lifetime"], 1) - assert.Equal(t, b.Params["target_pixel_id"], 1) - assert.Equal(t, b.Params["target_pixel_rules"], "text") + assert.Equal(t, 1, b.Params["account_id"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, 1, b.Params["target_group_id"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["domain"]) + assert.Equal(t, 1, b.Params["lifetime"]) + assert.Equal(t, 1, b.Params["target_pixel_id"]) + assert.Equal(t, "text", b.Params["target_pixel_rules"]) } diff --git a/api/params/appWidgets_test.go b/api/params/appWidgets_test.go index c1bd4bc2..c0885e53 100644 --- a/api/params/appWidgets_test.go +++ b/api/params/appWidgets_test.go @@ -15,6 +15,6 @@ func TestAppWidgetsUpdateBuilder(t *testing.T) { b.Code("text") b.Type("text") - assert.Equal(t, b.Params["code"], "text") - assert.Equal(t, b.Params["type"], "text") + assert.Equal(t, "text", b.Params["code"]) + assert.Equal(t, "text", b.Params["type"]) } diff --git a/api/params/apps_test.go b/api/params/apps_test.go index 4edf9ed7..0b6e787f 100644 --- a/api/params/apps_test.go +++ b/api/params/apps_test.go @@ -15,8 +15,8 @@ func TestAppsAddUsersToTestingGroupBuilder(t *testing.T) { b.UserIDs([]int{1}) b.GroupID(1) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestAppsGetBuilder(t *testing.T) { @@ -32,13 +32,13 @@ func TestAppsGetBuilder(t *testing.T) { b.Fields([]string{"test"}) b.NameCase("text") - assert.Equal(t, b.Params["app_id"], 1) - assert.Equal(t, b.Params["app_ids"], []string{"text"}) - assert.Equal(t, b.Params["platform"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["return_friends"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, 1, b.Params["app_id"]) + assert.Equal(t, []string{"text"}, b.Params["app_ids"]) + assert.Equal(t, "text", b.Params["platform"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["return_friends"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } func TestAppsGetCatalogBuilder(t *testing.T) { @@ -58,17 +58,17 @@ func TestAppsGetCatalogBuilder(t *testing.T) { b.GenreID(1) b.Filter("text") - assert.Equal(t, b.Params["sort"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["platform"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["return_friends"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["genre_id"], 1) - assert.Equal(t, b.Params["filter"], "text") + assert.Equal(t, "text", b.Params["sort"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["platform"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["return_friends"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["genre_id"]) + assert.Equal(t, "text", b.Params["filter"]) } func TestAppsGetFriendsListBuilder(t *testing.T) { @@ -82,11 +82,11 @@ func TestAppsGetFriendsListBuilder(t *testing.T) { b.Type("text") b.Fields([]string{"test"}) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestAppsGetLeaderboardBuilder(t *testing.T) { @@ -98,9 +98,9 @@ func TestAppsGetLeaderboardBuilder(t *testing.T) { b.Global(true) b.Extended(true) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["global"], true) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, true, b.Params["global"]) + assert.Equal(t, true, b.Params["extended"]) } func TestAppsGetScopesBuilder(t *testing.T) { @@ -110,7 +110,7 @@ func TestAppsGetScopesBuilder(t *testing.T) { b.Type("text") - assert.Equal(t, b.Params["type"], "text") + assert.Equal(t, "text", b.Params["type"]) } func TestAppsGetScoreBuilder(t *testing.T) { @@ -120,7 +120,7 @@ func TestAppsGetScoreBuilder(t *testing.T) { b.UserID(1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) } func TestAppsGetTestingGroupsBuilder(t *testing.T) { @@ -130,7 +130,7 @@ func TestAppsGetTestingGroupsBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestAppsRemoveUsersFromTestingGroupsBuilder(t *testing.T) { @@ -140,7 +140,7 @@ func TestAppsRemoveUsersFromTestingGroupsBuilder(t *testing.T) { b.UserIDs([]int{1}) - assert.Equal(t, b.Params["user_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["user_ids"]) } func TestAppsRemoveTestingGroupBuilder(t *testing.T) { @@ -150,7 +150,7 @@ func TestAppsRemoveTestingGroupBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestAppsSendRequestBuilder(t *testing.T) { @@ -165,12 +165,12 @@ func TestAppsSendRequestBuilder(t *testing.T) { b.Key("text") b.Separate(true) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["key"], "text") - assert.Equal(t, b.Params["separate"], true) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["key"]) + assert.Equal(t, true, b.Params["separate"]) } func TestAppsUpdateMetaForTestingGroupBuilder(t *testing.T) { @@ -184,9 +184,9 @@ func TestAppsUpdateMetaForTestingGroupBuilder(t *testing.T) { b.Platforms([]string{"text"}) b.UserIDs([]int{1}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["webview"], "text") - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["platforms"], []string{"text"}) - assert.Equal(t, b.Params["user_ids"], []int{1}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["webview"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, []string{"text"}, b.Params["platforms"]) + assert.Equal(t, []int{1}, b.Params["user_ids"]) } diff --git a/api/params/auth_test.go b/api/params/auth_test.go index 92b1dcf8..5f670a71 100644 --- a/api/params/auth_test.go +++ b/api/params/auth_test.go @@ -17,10 +17,10 @@ func TestAuthCheckPhoneBuilder(t *testing.T) { b.ClientSecret("text") b.AuthByPhone(true) - assert.Equal(t, b.Params["phone"], "text") - assert.Equal(t, b.Params["client_id"], 1) - assert.Equal(t, b.Params["client_secret"], "text") - assert.Equal(t, b.Params["auth_by_phone"], true) + assert.Equal(t, "text", b.Params["phone"]) + assert.Equal(t, 1, b.Params["client_id"]) + assert.Equal(t, "text", b.Params["client_secret"]) + assert.Equal(t, true, b.Params["auth_by_phone"]) } func TestAuthRestoreBuilder(t *testing.T) { @@ -31,8 +31,8 @@ func TestAuthRestoreBuilder(t *testing.T) { b.Phone("text") b.LastName("text") - assert.Equal(t, b.Params["phone"], "text") - assert.Equal(t, b.Params["last_name"], "text") + assert.Equal(t, "text", b.Params["phone"]) + assert.Equal(t, "text", b.Params["last_name"]) } func TestAuthGetProfileInfoBySilentTokenBuilder(t *testing.T) { @@ -41,14 +41,14 @@ func TestAuthGetProfileInfoBySilentTokenBuilder(t *testing.T) { b := params.NewAuthGetProfileInfoBySilentTokenBuilder() b.Add("token", "uuid", "event") - assert.Equal(t, b.Params["token"], "token") - assert.Equal(t, b.Params["uuid"], "uuid") - assert.Equal(t, b.Params["event"], "event") + assert.Equal(t, "token", b.Params["token"]) + assert.Equal(t, "uuid", b.Params["uuid"]) + assert.Equal(t, "event", b.Params["event"]) b.Add("token2", "uuid2", "event2") - assert.Equal(t, b.Params["token"], "token,token2") - assert.Equal(t, b.Params["uuid"], "uuid,uuid2") - assert.Equal(t, b.Params["event"], "event,event2") + assert.Equal(t, "token,token2", b.Params["token"]) + assert.Equal(t, "uuid,uuid2", b.Params["uuid"]) + assert.Equal(t, "event,event2", b.Params["event"]) } func TestAuthExchangeSilentAuthTokenBuilder(t *testing.T) { @@ -59,6 +59,6 @@ func TestAuthExchangeSilentAuthTokenBuilder(t *testing.T) { b.Token("token") b.UUID("uuid") - assert.Equal(t, b.Params["token"], "token") - assert.Equal(t, b.Params["uuid"], "uuid") + assert.Equal(t, "token", b.Params["token"]) + assert.Equal(t, "uuid", b.Params["uuid"]) } diff --git a/api/params/board_test.go b/api/params/board_test.go index 73eb5c9f..e1a7bf50 100644 --- a/api/params/board_test.go +++ b/api/params/board_test.go @@ -18,11 +18,11 @@ func TestBoardAddTopicBuilder(t *testing.T) { b.FromGroup(true) b.Attachments([]string{"text"}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["from_group"], true) - assert.Equal(t, b.Params["attachments"], []string{"text"}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, true, b.Params["from_group"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) } func TestBoardCloseTopicBuilder(t *testing.T) { @@ -33,8 +33,8 @@ func TestBoardCloseTopicBuilder(t *testing.T) { b.GroupID(1) b.TopicID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) } func TestBoardCreateCommentBuilder(t *testing.T) { @@ -50,13 +50,13 @@ func TestBoardCreateCommentBuilder(t *testing.T) { b.StickerID(1) b.GUID("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["from_group"], true) - assert.Equal(t, b.Params["sticker_id"], 1) - assert.Equal(t, b.Params["guid"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, true, b.Params["from_group"]) + assert.Equal(t, 1, b.Params["sticker_id"]) + assert.Equal(t, "text", b.Params["guid"]) } func TestBoardDeleteCommentBuilder(t *testing.T) { @@ -68,9 +68,9 @@ func TestBoardDeleteCommentBuilder(t *testing.T) { b.TopicID(1) b.CommentID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestBoardDeleteTopicBuilder(t *testing.T) { @@ -81,8 +81,8 @@ func TestBoardDeleteTopicBuilder(t *testing.T) { b.GroupID(1) b.TopicID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) } func TestBoardEditCommentBuilder(t *testing.T) { @@ -96,11 +96,11 @@ func TestBoardEditCommentBuilder(t *testing.T) { b.Message("text") b.Attachments([]string{"text"}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) } func TestBoardEditTopicBuilder(t *testing.T) { @@ -112,9 +112,9 @@ func TestBoardEditTopicBuilder(t *testing.T) { b.TopicID(1) b.Title("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) - assert.Equal(t, b.Params["title"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) + assert.Equal(t, "text", b.Params["title"]) } func TestBoardFixTopicBuilder(t *testing.T) { @@ -125,8 +125,8 @@ func TestBoardFixTopicBuilder(t *testing.T) { b.GroupID(1) b.TopicID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) } func TestBoardGetCommentsBuilder(t *testing.T) { @@ -143,14 +143,14 @@ func TestBoardGetCommentsBuilder(t *testing.T) { b.Extended(true) b.Sort("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) - assert.Equal(t, b.Params["need_likes"], true) - assert.Equal(t, b.Params["start_comment_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["sort"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) + assert.Equal(t, true, b.Params["need_likes"]) + assert.Equal(t, 1, b.Params["start_comment_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, "text", b.Params["sort"]) } func TestBoardGetTopicsBuilder(t *testing.T) { @@ -167,14 +167,14 @@ func TestBoardGetTopicsBuilder(t *testing.T) { b.Preview(1) b.PreviewLength(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_ids"], []int{1}) - assert.Equal(t, b.Params["order"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["preview"], 1) - assert.Equal(t, b.Params["preview_length"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, []int{1}, b.Params["topic_ids"]) + assert.Equal(t, 1, b.Params["order"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["preview"]) + assert.Equal(t, 1, b.Params["preview_length"]) } func TestBoardOpenTopicBuilder(t *testing.T) { @@ -185,8 +185,8 @@ func TestBoardOpenTopicBuilder(t *testing.T) { b.GroupID(1) b.TopicID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) } func TestBoardRestoreCommentBuilder(t *testing.T) { @@ -198,9 +198,9 @@ func TestBoardRestoreCommentBuilder(t *testing.T) { b.TopicID(1) b.CommentID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestBoardUnfixTopicBuilder(t *testing.T) { @@ -211,6 +211,6 @@ func TestBoardUnfixTopicBuilder(t *testing.T) { b.GroupID(1) b.TopicID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["topic_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["topic_id"]) } diff --git a/api/params/calls_test.go b/api/params/calls_test.go index 69b90d65..1c4b6860 100644 --- a/api/params/calls_test.go +++ b/api/params/calls_test.go @@ -14,7 +14,7 @@ func TestCallsStartBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestCallsForceFinishBuilder(t *testing.T) { @@ -24,5 +24,5 @@ func TestCallsForceFinishBuilder(t *testing.T) { b.CallID("text") - assert.Equal(t, b.Params["call_id"], "text") + assert.Equal(t, "text", b.Params["call_id"]) } diff --git a/api/params/database_test.go b/api/params/database_test.go index 2835ffbd..4bcc90af 100644 --- a/api/params/database_test.go +++ b/api/params/database_test.go @@ -16,9 +16,9 @@ func TestDatabaseGetChairsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["faculty_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["faculty_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestDatabaseGetCitiesBuilder(t *testing.T) { @@ -33,12 +33,12 @@ func TestDatabaseGetCitiesBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["country_id"], 1) - assert.Equal(t, b.Params["region_id"], 1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["need_all"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["country_id"]) + assert.Equal(t, 1, b.Params["region_id"]) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, true, b.Params["need_all"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestDatabaseGetCitiesByIDBuilder(t *testing.T) { @@ -48,7 +48,7 @@ func TestDatabaseGetCitiesByIDBuilder(t *testing.T) { b.CityIDs([]int{1}) - assert.Equal(t, b.Params["city_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["city_ids"]) } func TestDatabaseGetCountriesBuilder(t *testing.T) { @@ -61,10 +61,10 @@ func TestDatabaseGetCountriesBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["need_all"], true) - assert.Equal(t, b.Params["code"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, true, b.Params["need_all"]) + assert.Equal(t, "text", b.Params["code"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestDatabaseGetCountriesByIDBuilder(t *testing.T) { @@ -74,7 +74,7 @@ func TestDatabaseGetCountriesByIDBuilder(t *testing.T) { b.CountryIDs([]int{1}) - assert.Equal(t, b.Params["country_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["country_ids"]) } func TestDatabaseGetFacultiesBuilder(t *testing.T) { @@ -86,9 +86,9 @@ func TestDatabaseGetFacultiesBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["university_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["university_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestDatabaseGetMetroStationsBuilder(t *testing.T) { @@ -101,10 +101,10 @@ func TestDatabaseGetMetroStationsBuilder(t *testing.T) { b.Count(1) b.Extended(true) - assert.Equal(t, b.Params["city_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["city_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) } func TestDatabaseGetMetroStationsByIDBuilder(t *testing.T) { @@ -114,7 +114,7 @@ func TestDatabaseGetMetroStationsByIDBuilder(t *testing.T) { b.StationIDs([]int{1}) - assert.Equal(t, b.Params["station_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["station_ids"]) } func TestDatabaseGetRegionsBuilder(t *testing.T) { @@ -127,10 +127,10 @@ func TestDatabaseGetRegionsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["country_id"], 1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["country_id"]) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestDatabaseGetSchoolClassesBuilder(t *testing.T) { @@ -140,7 +140,7 @@ func TestDatabaseGetSchoolClassesBuilder(t *testing.T) { b.CountryID(1) - assert.Equal(t, b.Params["country_id"], 1) + assert.Equal(t, 1, b.Params["country_id"]) } func TestDatabaseGetSchoolsBuilder(t *testing.T) { @@ -153,10 +153,10 @@ func TestDatabaseGetSchoolsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["city_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["city_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestDatabaseGetUniversitiesBuilder(t *testing.T) { @@ -170,9 +170,9 @@ func TestDatabaseGetUniversitiesBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["country_id"], 1) - assert.Equal(t, b.Params["city_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["country_id"]) + assert.Equal(t, 1, b.Params["city_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } diff --git a/api/params/docs_test.go b/api/params/docs_test.go index be409802..eec55b32 100644 --- a/api/params/docs_test.go +++ b/api/params/docs_test.go @@ -16,9 +16,9 @@ func TestDocsAddBuilder(t *testing.T) { b.DocID(1) b.AccessKey("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["doc_id"], 1) - assert.Equal(t, b.Params["access_key"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["doc_id"]) + assert.Equal(t, "text", b.Params["access_key"]) } func TestDocsDeleteBuilder(t *testing.T) { @@ -29,8 +29,8 @@ func TestDocsDeleteBuilder(t *testing.T) { b.OwnerID(1) b.DocID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["doc_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["doc_id"]) } func TestDocsEditBuilder(t *testing.T) { @@ -43,10 +43,10 @@ func TestDocsEditBuilder(t *testing.T) { b.Title("text") b.Tags([]string{"text"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["doc_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["tags"], []string{"text"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["doc_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, []string{"text"}, b.Params["tags"]) } func TestDocsGetBuilder(t *testing.T) { @@ -59,10 +59,10 @@ func TestDocsGetBuilder(t *testing.T) { b.Type(1) b.OwnerID(1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["type"], 1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestDocsGetByIDBuilder(t *testing.T) { @@ -72,7 +72,7 @@ func TestDocsGetByIDBuilder(t *testing.T) { b.Docs([]string{"text"}) - assert.Equal(t, b.Params["docs"], []string{"text"}) + assert.Equal(t, []string{"text"}, b.Params["docs"]) } func TestDocsGetMessagesUploadServerBuilder(t *testing.T) { @@ -83,8 +83,8 @@ func TestDocsGetMessagesUploadServerBuilder(t *testing.T) { b.Type("text") b.PeerID(1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["peer_id"], 1) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["peer_id"]) } func TestDocsGetTypesBuilder(t *testing.T) { @@ -94,7 +94,7 @@ func TestDocsGetTypesBuilder(t *testing.T) { b.OwnerID(1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestDocsGetUploadServerBuilder(t *testing.T) { @@ -104,7 +104,7 @@ func TestDocsGetUploadServerBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestDocsGetWallUploadServerBuilder(t *testing.T) { @@ -114,7 +114,7 @@ func TestDocsGetWallUploadServerBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestDocsSaveBuilder(t *testing.T) { @@ -126,9 +126,9 @@ func TestDocsSaveBuilder(t *testing.T) { b.Title("text") b.Tags("text") - assert.Equal(t, b.Params["file"], "text") - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["tags"], "text") + assert.Equal(t, "text", b.Params["file"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["tags"]) } func TestDocsSearchBuilder(t *testing.T) { @@ -141,8 +141,8 @@ func TestDocsSearchBuilder(t *testing.T) { b.Count(1) b.Offset(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["search_own"], true) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, true, b.Params["search_own"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) } diff --git a/api/params/donut_test.go b/api/params/donut_test.go index b73d11f4..9d967c13 100644 --- a/api/params/donut_test.go +++ b/api/params/donut_test.go @@ -17,10 +17,10 @@ func TestDonutGetFriendsBuilder(t *testing.T) { b.Count(1) b.Fields([]string{"text"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"text"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"text"}, b.Params["fields"]) } func TestDonutGetSubscriptionBuilder(t *testing.T) { @@ -30,7 +30,7 @@ func TestDonutGetSubscriptionBuilder(t *testing.T) { b.OwnerID(1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestDonutGetSubscriptionsBuilder(t *testing.T) { @@ -42,9 +42,9 @@ func TestDonutGetSubscriptionsBuilder(t *testing.T) { b.Count(1) b.Fields([]string{"text"}) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"text"}) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"text"}, b.Params["fields"]) } func TestDonutIsDonBuilder(t *testing.T) { @@ -54,5 +54,5 @@ func TestDonutIsDonBuilder(t *testing.T) { b.OwnerID(1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) } diff --git a/api/params/downloadedGames_test.go b/api/params/downloadedGames_test.go index bdbb8a2e..9b945310 100644 --- a/api/params/downloadedGames_test.go +++ b/api/params/downloadedGames_test.go @@ -14,5 +14,5 @@ func TestDownloadedGamesGetPaidStatusBuilder(t *testing.T) { b.UserID(1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) } diff --git a/api/params/fave_test.go b/api/params/fave_test.go index 89f150d0..817eb85e 100644 --- a/api/params/fave_test.go +++ b/api/params/fave_test.go @@ -14,7 +14,7 @@ func TestFaveAddArticleBuilder(t *testing.T) { b.URL("text") - assert.Equal(t, b.Params["url"], "text") + assert.Equal(t, "text", b.Params["url"]) } func TestFaveAddLinkBuilder(t *testing.T) { @@ -24,7 +24,7 @@ func TestFaveAddLinkBuilder(t *testing.T) { b.Link("text") - assert.Equal(t, b.Params["link"], "text") + assert.Equal(t, "text", b.Params["link"]) } func TestFaveAddPageBuilder(t *testing.T) { @@ -35,8 +35,8 @@ func TestFaveAddPageBuilder(t *testing.T) { b.UserID(1) b.GroupID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestFaveAddPostBuilder(t *testing.T) { @@ -48,9 +48,9 @@ func TestFaveAddPostBuilder(t *testing.T) { b.ID(1) b.AccessKey("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["id"], 1) - assert.Equal(t, b.Params["access_key"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["id"]) + assert.Equal(t, "text", b.Params["access_key"]) } func TestFaveAddProductBuilder(t *testing.T) { @@ -62,9 +62,9 @@ func TestFaveAddProductBuilder(t *testing.T) { b.ID(1) b.AccessKey("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["id"], 1) - assert.Equal(t, b.Params["access_key"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["id"]) + assert.Equal(t, "text", b.Params["access_key"]) } func TestFaveAddTagBuilder(t *testing.T) { @@ -74,7 +74,7 @@ func TestFaveAddTagBuilder(t *testing.T) { b.Name("text") - assert.Equal(t, b.Params["name"], "text") + assert.Equal(t, "text", b.Params["name"]) } func TestFaveAddVideoBuilder(t *testing.T) { @@ -86,9 +86,9 @@ func TestFaveAddVideoBuilder(t *testing.T) { b.ID(1) b.AccessKey("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["id"], 1) - assert.Equal(t, b.Params["access_key"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["id"]) + assert.Equal(t, "text", b.Params["access_key"]) } func TestFaveEditTagBuilder(t *testing.T) { @@ -99,8 +99,8 @@ func TestFaveEditTagBuilder(t *testing.T) { b.ID(1) b.Name("text") - assert.Equal(t, b.Params["id"], 1) - assert.Equal(t, b.Params["name"], "text") + assert.Equal(t, 1, b.Params["id"]) + assert.Equal(t, "text", b.Params["name"]) } func TestFaveGetBuilder(t *testing.T) { @@ -116,13 +116,13 @@ func TestFaveGetBuilder(t *testing.T) { b.Fields("text") b.IsFromSnackbar(true) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["item_type"], "text") - assert.Equal(t, b.Params["tag_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], "text") - assert.Equal(t, b.Params["is_from_snackbar"], true) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, "text", b.Params["item_type"]) + assert.Equal(t, 1, b.Params["tag_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["fields"]) + assert.Equal(t, true, b.Params["is_from_snackbar"]) } func TestFaveGetPagesBuilder(t *testing.T) { @@ -136,11 +136,11 @@ func TestFaveGetPagesBuilder(t *testing.T) { b.Fields([]string{"test"}) b.TagID(1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["tag_id"], 1) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["tag_id"]) } func TestFaveRemoveArticleBuilder(t *testing.T) { @@ -151,8 +151,8 @@ func TestFaveRemoveArticleBuilder(t *testing.T) { b.OwnerID(1) b.ArticleID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["article_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["article_id"]) } func TestFaveRemoveLinkBuilder(t *testing.T) { @@ -163,8 +163,8 @@ func TestFaveRemoveLinkBuilder(t *testing.T) { b.LinkID("text") b.Link("text") - assert.Equal(t, b.Params["link_id"], "text") - assert.Equal(t, b.Params["link"], "text") + assert.Equal(t, "text", b.Params["link_id"]) + assert.Equal(t, "text", b.Params["link"]) } func TestFaveRemovePageBuilder(t *testing.T) { @@ -175,8 +175,8 @@ func TestFaveRemovePageBuilder(t *testing.T) { b.UserID(1) b.GroupID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestFaveRemovePostBuilder(t *testing.T) { @@ -187,8 +187,8 @@ func TestFaveRemovePostBuilder(t *testing.T) { b.OwnerID(1) b.ID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["id"]) } func TestFaveRemoveProductBuilder(t *testing.T) { @@ -199,8 +199,8 @@ func TestFaveRemoveProductBuilder(t *testing.T) { b.OwnerID(1) b.ID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["id"]) } func TestFaveRemoveTagBuilder(t *testing.T) { @@ -210,7 +210,7 @@ func TestFaveRemoveTagBuilder(t *testing.T) { b.ID(1) - assert.Equal(t, b.Params["id"], 1) + assert.Equal(t, 1, b.Params["id"]) } func TestFaveReorderTagsBuilder(t *testing.T) { @@ -220,7 +220,7 @@ func TestFaveReorderTagsBuilder(t *testing.T) { b.IDs([]int{1}) - assert.Equal(t, b.Params["ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["ids"]) } func TestFaveSetPageTagsBuilder(t *testing.T) { @@ -232,9 +232,9 @@ func TestFaveSetPageTagsBuilder(t *testing.T) { b.GroupID(1) b.TagIDs([]int{1}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["tag_ids"], []int{1}) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, []int{1}, b.Params["tag_ids"]) } func TestFaveSetTagsBuilder(t *testing.T) { @@ -249,12 +249,12 @@ func TestFaveSetTagsBuilder(t *testing.T) { b.LinkID("text") b.LinkURL("text") - assert.Equal(t, b.Params["item_type"], "text") - assert.Equal(t, b.Params["item_owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["tag_ids"], []int{1}) - assert.Equal(t, b.Params["link_id"], "text") - assert.Equal(t, b.Params["link_url"], "text") + assert.Equal(t, "text", b.Params["item_type"]) + assert.Equal(t, 1, b.Params["item_owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, []int{1}, b.Params["tag_ids"]) + assert.Equal(t, "text", b.Params["link_id"]) + assert.Equal(t, "text", b.Params["link_url"]) } func TestFaveTrackPageInteractionBuilder(t *testing.T) { @@ -265,6 +265,6 @@ func TestFaveTrackPageInteractionBuilder(t *testing.T) { b.UserID(1) b.GroupID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } diff --git a/api/params/friends_test.go b/api/params/friends_test.go index 844ced4c..13dca99a 100644 --- a/api/params/friends_test.go +++ b/api/params/friends_test.go @@ -16,9 +16,9 @@ func TestFriendsAddBuilder(t *testing.T) { b.Text("text") b.Follow(true) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["follow"], true) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, true, b.Params["follow"]) } func TestFriendsAddListBuilder(t *testing.T) { @@ -29,8 +29,8 @@ func TestFriendsAddListBuilder(t *testing.T) { b.Name("text") b.UserIDs([]int{1}) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["user_ids"], []int{1}) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, []int{1}, b.Params["user_ids"]) } func TestFriendsAreFriendsBuilder(t *testing.T) { @@ -41,8 +41,8 @@ func TestFriendsAreFriendsBuilder(t *testing.T) { b.UserIDs([]int{1}) b.NeedSign(true) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["need_sign"], true) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, true, b.Params["need_sign"]) } func TestFriendsDeleteBuilder(t *testing.T) { @@ -52,7 +52,7 @@ func TestFriendsDeleteBuilder(t *testing.T) { b.UserID(1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) } func TestFriendsDeleteListBuilder(t *testing.T) { @@ -62,7 +62,7 @@ func TestFriendsDeleteListBuilder(t *testing.T) { b.ListID(1) - assert.Equal(t, b.Params["list_id"], 1) + assert.Equal(t, 1, b.Params["list_id"]) } func TestFriendsEditBuilder(t *testing.T) { @@ -73,8 +73,8 @@ func TestFriendsEditBuilder(t *testing.T) { b.UserID(1) b.ListIDs([]int{1}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["list_ids"], []int{1}) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, []int{1}, b.Params["list_ids"]) } func TestFriendsEditListBuilder(t *testing.T) { @@ -88,11 +88,11 @@ func TestFriendsEditListBuilder(t *testing.T) { b.AddUserIDs([]int{1}) b.DeleteUserIDs([]int{1}) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["list_id"], 1) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["add_user_ids"], []int{1}) - assert.Equal(t, b.Params["delete_user_ids"], []int{1}) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, 1, b.Params["list_id"]) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, []int{1}, b.Params["add_user_ids"]) + assert.Equal(t, []int{1}, b.Params["delete_user_ids"]) } func TestFriendsGetBuilder(t *testing.T) { @@ -109,14 +109,14 @@ func TestFriendsGetBuilder(t *testing.T) { b.NameCase("text") b.Ref("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["order"], "text") - assert.Equal(t, b.Params["list_id"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") - assert.Equal(t, b.Params["ref"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["order"]) + assert.Equal(t, 1, b.Params["list_id"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) + assert.Equal(t, "text", b.Params["ref"]) } func TestFriendsGetByPhonesBuilder(t *testing.T) { @@ -127,8 +127,8 @@ func TestFriendsGetByPhonesBuilder(t *testing.T) { b.Phones([]string{"text"}) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["phones"], []string{"text"}) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, []string{"text"}, b.Params["phones"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestFriendsGetListsBuilder(t *testing.T) { @@ -139,8 +139,8 @@ func TestFriendsGetListsBuilder(t *testing.T) { b.UserID(1) b.ReturnSystem(true) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["return_system"], true) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, true, b.Params["return_system"]) } func TestFriendsGetMutualBuilder(t *testing.T) { @@ -155,12 +155,12 @@ func TestFriendsGetMutualBuilder(t *testing.T) { b.Count(1) b.Offset(1) - assert.Equal(t, b.Params["source_uid"], 1) - assert.Equal(t, b.Params["target_uid"], 1) - assert.Equal(t, b.Params["target_uids"], []int{1}) - assert.Equal(t, b.Params["order"], "text") - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, 1, b.Params["source_uid"]) + assert.Equal(t, 1, b.Params["target_uid"]) + assert.Equal(t, []int{1}, b.Params["target_uids"]) + assert.Equal(t, "text", b.Params["order"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) } func TestFriendsGetOnlineBuilder(t *testing.T) { @@ -175,12 +175,12 @@ func TestFriendsGetOnlineBuilder(t *testing.T) { b.Count(1) b.Offset(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["list_id"], 1) - assert.Equal(t, b.Params["online_mobile"], true) - assert.Equal(t, b.Params["order"], "text") - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["list_id"]) + assert.Equal(t, true, b.Params["online_mobile"]) + assert.Equal(t, "text", b.Params["order"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) } func TestFriendsGetRecentBuilder(t *testing.T) { @@ -190,7 +190,7 @@ func TestFriendsGetRecentBuilder(t *testing.T) { b.Count(1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["count"]) } func TestFriendsGetRequestsBuilder(t *testing.T) { @@ -209,16 +209,16 @@ func TestFriendsGetRequestsBuilder(t *testing.T) { b.Ref("text") b.Fields([]string{"test"}) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["need_mutual"], true) - assert.Equal(t, b.Params["out"], true) - assert.Equal(t, b.Params["sort"], 1) - assert.Equal(t, b.Params["need_viewed"], true) - assert.Equal(t, b.Params["suggested"], true) - assert.Equal(t, b.Params["ref"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["need_mutual"]) + assert.Equal(t, true, b.Params["out"]) + assert.Equal(t, 1, b.Params["sort"]) + assert.Equal(t, true, b.Params["need_viewed"]) + assert.Equal(t, true, b.Params["suggested"]) + assert.Equal(t, "text", b.Params["ref"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestFriendsGetSuggestionsBuilder(t *testing.T) { @@ -232,11 +232,11 @@ func TestFriendsGetSuggestionsBuilder(t *testing.T) { b.Fields([]string{"test"}) b.NameCase("text") - assert.Equal(t, b.Params["filter"], []string{"text"}) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, []string{"text"}, b.Params["filter"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } func TestFriendsSearchBuilder(t *testing.T) { @@ -251,10 +251,10 @@ func TestFriendsSearchBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } diff --git a/api/params/gifts_test.go b/api/params/gifts_test.go index 4ed5a105..ca96e2e1 100644 --- a/api/params/gifts_test.go +++ b/api/params/gifts_test.go @@ -16,7 +16,7 @@ func TestGiftsGetBuilder(t *testing.T) { b.Count(1) b.Offset(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) } diff --git a/api/params/groups_test.go b/api/params/groups_test.go index 804dcd13..2a263267 100644 --- a/api/params/groups_test.go +++ b/api/params/groups_test.go @@ -26,19 +26,19 @@ func TestGroupsAddAddressBuilder(t *testing.T) { b.Timetable("text") b.IsMainAddress(true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["address"], "text") - assert.Equal(t, b.Params["additional_address"], "text") - assert.Equal(t, b.Params["country_id"], 1) - assert.Equal(t, b.Params["city_id"], 1) - assert.Equal(t, b.Params["metro_id"], 1) - assert.Equal(t, b.Params["latitude"], 1.1) - assert.Equal(t, b.Params["longitude"], 1.1) - assert.Equal(t, b.Params["phone"], "text") - assert.Equal(t, b.Params["work_info_status"], "text") - assert.Equal(t, b.Params["timetable"], "text") - assert.Equal(t, b.Params["is_main_address"], true) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["address"]) + assert.Equal(t, "text", b.Params["additional_address"]) + assert.Equal(t, 1, b.Params["country_id"]) + assert.Equal(t, 1, b.Params["city_id"]) + assert.Equal(t, 1, b.Params["metro_id"]) + assert.InEpsilon(t, 1.1, b.Params["latitude"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["longitude"], 0.1) + assert.Equal(t, "text", b.Params["phone"]) + assert.Equal(t, "text", b.Params["work_info_status"]) + assert.Equal(t, "text", b.Params["timetable"]) + assert.Equal(t, true, b.Params["is_main_address"]) } func TestGroupsAddCallbackServerBuilder(t *testing.T) { @@ -51,10 +51,10 @@ func TestGroupsAddCallbackServerBuilder(t *testing.T) { b.Title("text") b.SecretKey("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["url"], "text") - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["secret_key"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["url"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["secret_key"]) } func TestGroupsAddLinkBuilder(t *testing.T) { @@ -66,9 +66,9 @@ func TestGroupsAddLinkBuilder(t *testing.T) { b.Link("text") b.Text("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["link"], "text") - assert.Equal(t, b.Params["text"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["link"]) + assert.Equal(t, "text", b.Params["text"]) } func TestGroupsApproveRequestBuilder(t *testing.T) { @@ -79,8 +79,8 @@ func TestGroupsApproveRequestBuilder(t *testing.T) { b.GroupID(1) b.UserID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) } func TestGroupsBanBuilder(t *testing.T) { @@ -95,12 +95,12 @@ func TestGroupsBanBuilder(t *testing.T) { b.Comment("text") b.CommentVisible(true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["end_date"], 1) - assert.Equal(t, b.Params["reason"], 1) - assert.Equal(t, b.Params["comment"], "text") - assert.Equal(t, b.Params["comment_visible"], true) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["end_date"]) + assert.Equal(t, 1, b.Params["reason"]) + assert.Equal(t, "text", b.Params["comment"]) + assert.Equal(t, true, b.Params["comment_visible"]) } func TestGroupsCreateBuilder(t *testing.T) { @@ -115,12 +115,12 @@ func TestGroupsCreateBuilder(t *testing.T) { b.PublicSubcategory(1) b.Subtype(1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["public_category"], 1) - assert.Equal(t, b.Params["public_subcategory"], 1) - assert.Equal(t, b.Params["subtype"], 1) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["public_category"]) + assert.Equal(t, 1, b.Params["public_subcategory"]) + assert.Equal(t, 1, b.Params["subtype"]) } func TestGroupsDeleteCallbackServerBuilder(t *testing.T) { @@ -131,8 +131,8 @@ func TestGroupsDeleteCallbackServerBuilder(t *testing.T) { b.GroupID(1) b.ServerID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["server_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["server_id"]) } func TestGroupsDeleteLinkBuilder(t *testing.T) { @@ -143,8 +143,8 @@ func TestGroupsDeleteLinkBuilder(t *testing.T) { b.GroupID(1) b.LinkID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["link_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["link_id"]) } func TestGroupsDisableOnlineBuilder(t *testing.T) { @@ -154,7 +154,7 @@ func TestGroupsDisableOnlineBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsEditBuilder(t *testing.T) { @@ -208,51 +208,51 @@ func TestGroupsEditBuilder(t *testing.T) { b.Country(1) b.City(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["screen_name"], "text") - assert.Equal(t, b.Params["access"], 1) - assert.Equal(t, b.Params["website"], "text") - assert.Equal(t, b.Params["subject"], "text") - assert.Equal(t, b.Params["email"], "text") - assert.Equal(t, b.Params["phone"], "text") - assert.Equal(t, b.Params["rss"], "text") - assert.Equal(t, b.Params["event_start_date"], 1) - assert.Equal(t, b.Params["event_finish_date"], 1) - assert.Equal(t, b.Params["event_group_id"], 1) - assert.Equal(t, b.Params["public_category"], 1) - assert.Equal(t, b.Params["public_subcategory"], 1) - assert.Equal(t, b.Params["public_date"], "text") - assert.Equal(t, b.Params["wall"], 1) - assert.Equal(t, b.Params["topics"], 1) - assert.Equal(t, b.Params["photos"], 1) - assert.Equal(t, b.Params["video"], 1) - assert.Equal(t, b.Params["audio"], 1) - assert.Equal(t, b.Params["links"], true) - assert.Equal(t, b.Params["events"], true) - assert.Equal(t, b.Params["places"], true) - assert.Equal(t, b.Params["contacts"], true) - assert.Equal(t, b.Params["docs"], 1) - assert.Equal(t, b.Params["wiki"], 1) - assert.Equal(t, b.Params["messages"], true) - assert.Equal(t, b.Params["articles"], true) - assert.Equal(t, b.Params["addresses"], true) - assert.Equal(t, b.Params["age_limits"], 1) - assert.Equal(t, b.Params["market"], true) - assert.Equal(t, b.Params["market_comments"], true) - assert.Equal(t, b.Params["market_country"], []int{1}) - assert.Equal(t, b.Params["market_city"], []int{1}) - assert.Equal(t, b.Params["market_currency"], 1) - assert.Equal(t, b.Params["market_contact"], 1) - assert.Equal(t, b.Params["market_wiki"], 1) - assert.Equal(t, b.Params["obscene_filter"], true) - assert.Equal(t, b.Params["obscene_stopwords"], true) - assert.Equal(t, b.Params["obscene_words"], []string{"text"}) - assert.Equal(t, b.Params["main_section"], 1) - assert.Equal(t, b.Params["secondary_section"], 1) - assert.Equal(t, b.Params["country"], 1) - assert.Equal(t, b.Params["city"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, "text", b.Params["screen_name"]) + assert.Equal(t, 1, b.Params["access"]) + assert.Equal(t, "text", b.Params["website"]) + assert.Equal(t, "text", b.Params["subject"]) + assert.Equal(t, "text", b.Params["email"]) + assert.Equal(t, "text", b.Params["phone"]) + assert.Equal(t, "text", b.Params["rss"]) + assert.Equal(t, 1, b.Params["event_start_date"]) + assert.Equal(t, 1, b.Params["event_finish_date"]) + assert.Equal(t, 1, b.Params["event_group_id"]) + assert.Equal(t, 1, b.Params["public_category"]) + assert.Equal(t, 1, b.Params["public_subcategory"]) + assert.Equal(t, "text", b.Params["public_date"]) + assert.Equal(t, 1, b.Params["wall"]) + assert.Equal(t, 1, b.Params["topics"]) + assert.Equal(t, 1, b.Params["photos"]) + assert.Equal(t, 1, b.Params["video"]) + assert.Equal(t, 1, b.Params["audio"]) + assert.Equal(t, true, b.Params["links"]) + assert.Equal(t, true, b.Params["events"]) + assert.Equal(t, true, b.Params["places"]) + assert.Equal(t, true, b.Params["contacts"]) + assert.Equal(t, 1, b.Params["docs"]) + assert.Equal(t, 1, b.Params["wiki"]) + assert.Equal(t, true, b.Params["messages"]) + assert.Equal(t, true, b.Params["articles"]) + assert.Equal(t, true, b.Params["addresses"]) + assert.Equal(t, 1, b.Params["age_limits"]) + assert.Equal(t, true, b.Params["market"]) + assert.Equal(t, true, b.Params["market_comments"]) + assert.Equal(t, []int{1}, b.Params["market_country"]) + assert.Equal(t, []int{1}, b.Params["market_city"]) + assert.Equal(t, 1, b.Params["market_currency"]) + assert.Equal(t, 1, b.Params["market_contact"]) + assert.Equal(t, 1, b.Params["market_wiki"]) + assert.Equal(t, true, b.Params["obscene_filter"]) + assert.Equal(t, true, b.Params["obscene_stopwords"]) + assert.Equal(t, []string{"text"}, b.Params["obscene_words"]) + assert.Equal(t, 1, b.Params["main_section"]) + assert.Equal(t, 1, b.Params["secondary_section"]) + assert.Equal(t, 1, b.Params["country"]) + assert.Equal(t, 1, b.Params["city"]) } func TestGroupsEditAddressBuilder(t *testing.T) { @@ -275,20 +275,20 @@ func TestGroupsEditAddressBuilder(t *testing.T) { b.Timetable("text") b.IsMainAddress(true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["address_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["address"], "text") - assert.Equal(t, b.Params["additional_address"], "text") - assert.Equal(t, b.Params["country_id"], 1) - assert.Equal(t, b.Params["city_id"], 1) - assert.Equal(t, b.Params["metro_id"], 1) - assert.Equal(t, b.Params["latitude"], 1.1) - assert.Equal(t, b.Params["longitude"], 1.1) - assert.Equal(t, b.Params["phone"], "text") - assert.Equal(t, b.Params["work_info_status"], "text") - assert.Equal(t, b.Params["timetable"], "text") - assert.Equal(t, b.Params["is_main_address"], true) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["address_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["address"]) + assert.Equal(t, "text", b.Params["additional_address"]) + assert.Equal(t, 1, b.Params["country_id"]) + assert.Equal(t, 1, b.Params["city_id"]) + assert.Equal(t, 1, b.Params["metro_id"]) + assert.InEpsilon(t, 1.1, b.Params["latitude"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["longitude"], 0.1) + assert.Equal(t, "text", b.Params["phone"]) + assert.Equal(t, "text", b.Params["work_info_status"]) + assert.Equal(t, "text", b.Params["timetable"]) + assert.Equal(t, true, b.Params["is_main_address"]) } func TestGroupsEditCallbackServerBuilder(t *testing.T) { @@ -302,11 +302,11 @@ func TestGroupsEditCallbackServerBuilder(t *testing.T) { b.Title("text") b.SecretKey("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["server_id"], 1) - assert.Equal(t, b.Params["url"], "text") - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["secret_key"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["server_id"]) + assert.Equal(t, "text", b.Params["url"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["secret_key"]) } func TestGroupsEditLinkBuilder(t *testing.T) { @@ -318,9 +318,9 @@ func TestGroupsEditLinkBuilder(t *testing.T) { b.LinkID(1) b.Text("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["link_id"], 1) - assert.Equal(t, b.Params["text"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["link_id"]) + assert.Equal(t, "text", b.Params["text"]) } func TestGroupsEditManagerBuilder(t *testing.T) { @@ -336,13 +336,13 @@ func TestGroupsEditManagerBuilder(t *testing.T) { b.ContactPhone("text") b.ContactEmail("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["role"], "text") - assert.Equal(t, b.Params["is_contact"], true) - assert.Equal(t, b.Params["contact_position"], "text") - assert.Equal(t, b.Params["contact_phone"], "text") - assert.Equal(t, b.Params["contact_email"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["role"]) + assert.Equal(t, true, b.Params["is_contact"]) + assert.Equal(t, "text", b.Params["contact_position"]) + assert.Equal(t, "text", b.Params["contact_phone"]) + assert.Equal(t, "text", b.Params["contact_email"]) } func TestGroupsEnableOnlineBuilder(t *testing.T) { @@ -352,7 +352,7 @@ func TestGroupsEnableOnlineBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsGetBuilder(t *testing.T) { @@ -367,12 +367,12 @@ func TestGroupsGetBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["filter"], []string{"test"}) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["filter"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestGroupsGetAddressesBuilder(t *testing.T) { @@ -388,13 +388,13 @@ func TestGroupsGetAddressesBuilder(t *testing.T) { b.Count(1) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["address_ids"], []int{1}) - assert.Equal(t, b.Params["latitude"], 1.1) - assert.Equal(t, b.Params["longitude"], 1.1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, []int{1}, b.Params["address_ids"]) + assert.InEpsilon(t, 1.1, b.Params["latitude"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["longitude"], 0.1) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestGroupsGetBannedBuilder(t *testing.T) { @@ -408,11 +408,11 @@ func TestGroupsGetBannedBuilder(t *testing.T) { b.Fields([]string{"test"}) b.OwnerID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestGroupsGetByIDBuilder(t *testing.T) { @@ -424,9 +424,9 @@ func TestGroupsGetByIDBuilder(t *testing.T) { b.GroupID("text") b.Fields([]string{"test"}) - assert.Equal(t, b.Params["group_ids"], []string{"text"}) - assert.Equal(t, b.Params["group_id"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, []string{"text"}, b.Params["group_ids"]) + assert.Equal(t, "text", b.Params["group_id"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestGroupsGetCallbackConfirmationCodeBuilder(t *testing.T) { @@ -436,7 +436,7 @@ func TestGroupsGetCallbackConfirmationCodeBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsGetCallbackServersBuilder(t *testing.T) { @@ -447,8 +447,8 @@ func TestGroupsGetCallbackServersBuilder(t *testing.T) { b.GroupID(1) b.ServerIDs([]int{1}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["server_ids"], []int{1}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, []int{1}, b.Params["server_ids"]) } func TestGroupsGetCallbackSettingsBuilder(t *testing.T) { @@ -459,8 +459,8 @@ func TestGroupsGetCallbackSettingsBuilder(t *testing.T) { b.GroupID(1) b.ServerID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["server_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["server_id"]) } func TestGroupsGetCatalogBuilder(t *testing.T) { @@ -471,8 +471,8 @@ func TestGroupsGetCatalogBuilder(t *testing.T) { b.CategoryID(1) b.SubcategoryID(1) - assert.Equal(t, b.Params["category_id"], 1) - assert.Equal(t, b.Params["subcategory_id"], 1) + assert.Equal(t, 1, b.Params["category_id"]) + assert.Equal(t, 1, b.Params["subcategory_id"]) } func TestGroupsGetCatalogInfoBuilder(t *testing.T) { @@ -483,8 +483,8 @@ func TestGroupsGetCatalogInfoBuilder(t *testing.T) { b.Extended(true) b.Subcategories(true) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["subcategories"], true) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["subcategories"]) } func TestGroupsGetInvitedUsersBuilder(t *testing.T) { @@ -498,11 +498,11 @@ func TestGroupsGetInvitedUsersBuilder(t *testing.T) { b.Fields([]string{"test"}) b.NameCase("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } func TestGroupsGetInvitesBuilder(t *testing.T) { @@ -514,9 +514,9 @@ func TestGroupsGetInvitesBuilder(t *testing.T) { b.Count(1) b.Extended(true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) } func TestGroupsGetLongPollServerBuilder(t *testing.T) { @@ -526,7 +526,7 @@ func TestGroupsGetLongPollServerBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsGetLongPollSettingsBuilder(t *testing.T) { @@ -536,7 +536,7 @@ func TestGroupsGetLongPollSettingsBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsGetMembersBuilder(t *testing.T) { @@ -551,12 +551,12 @@ func TestGroupsGetMembersBuilder(t *testing.T) { b.Fields([]string{"test"}) b.Filter("text") - assert.Equal(t, b.Params["group_id"], "text") - assert.Equal(t, b.Params["sort"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["filter"], "text") + assert.Equal(t, "text", b.Params["group_id"]) + assert.Equal(t, "text", b.Params["sort"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["filter"]) } func TestGroupsGetRequestsBuilder(t *testing.T) { @@ -569,10 +569,10 @@ func TestGroupsGetRequestsBuilder(t *testing.T) { b.Count(1) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestGroupsGetSettingsBuilder(t *testing.T) { @@ -582,7 +582,7 @@ func TestGroupsGetSettingsBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsGetTagListBuilder(t *testing.T) { @@ -592,7 +592,7 @@ func TestGroupsGetTagListBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsInviteBuilder(t *testing.T) { @@ -603,8 +603,8 @@ func TestGroupsInviteBuilder(t *testing.T) { b.GroupID(1) b.UserID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) } func TestGroupsIsMemberBuilder(t *testing.T) { @@ -617,10 +617,10 @@ func TestGroupsIsMemberBuilder(t *testing.T) { b.UserIDs([]int{1}) b.Extended(true) - assert.Equal(t, b.Params["group_id"], "text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, "text", b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, true, b.Params["extended"]) } func TestGroupsJoinBuilder(t *testing.T) { @@ -631,8 +631,8 @@ func TestGroupsJoinBuilder(t *testing.T) { b.GroupID(1) b.NotSure("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["not_sure"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["not_sure"]) } func TestGroupsLeaveBuilder(t *testing.T) { @@ -642,7 +642,7 @@ func TestGroupsLeaveBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestGroupsRemoveUserBuilder(t *testing.T) { @@ -653,8 +653,8 @@ func TestGroupsRemoveUserBuilder(t *testing.T) { b.GroupID(1) b.UserID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) } func TestGroupsReorderLinkBuilder(t *testing.T) { @@ -666,9 +666,9 @@ func TestGroupsReorderLinkBuilder(t *testing.T) { b.LinkID(1) b.After(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["link_id"], 1) - assert.Equal(t, b.Params["after"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["link_id"]) + assert.Equal(t, 1, b.Params["after"]) } func TestGroupsSearchBuilder(t *testing.T) { @@ -686,15 +686,15 @@ func TestGroupsSearchBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["country_id"], 1) - assert.Equal(t, b.Params["city_id"], 1) - assert.Equal(t, b.Params["future"], true) - assert.Equal(t, b.Params["market"], true) - assert.Equal(t, b.Params["sort"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["country_id"]) + assert.Equal(t, 1, b.Params["city_id"]) + assert.Equal(t, true, b.Params["future"]) + assert.Equal(t, true, b.Params["market"]) + assert.Equal(t, 1, b.Params["sort"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestGroupsSetCallbackSettingsBuilder(t *testing.T) { @@ -757,60 +757,60 @@ func TestGroupsSetCallbackSettingsBuilder(t *testing.T) { b.DonutMoneyWithdraw(true) b.DonutMoneyWithdrawError(true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["server_id"], 1) - assert.Equal(t, b.Params["api_version"], "text") - assert.Equal(t, b.Params["message_new"], true) - assert.Equal(t, b.Params["message_reply"], true) - assert.Equal(t, b.Params["message_allow"], true) - assert.Equal(t, b.Params["message_edit"], true) - assert.Equal(t, b.Params["message_deny"], true) - assert.Equal(t, b.Params["message_typing_state"], true) - assert.Equal(t, b.Params["photo_new"], true) - assert.Equal(t, b.Params["audio_new"], true) - assert.Equal(t, b.Params["video_new"], true) - assert.Equal(t, b.Params["wall_reply_new"], true) - assert.Equal(t, b.Params["wall_reply_edit"], true) - assert.Equal(t, b.Params["wall_reply_delete"], true) - assert.Equal(t, b.Params["wall_reply_restore"], true) - assert.Equal(t, b.Params["wall_post_new"], true) - assert.Equal(t, b.Params["wall_repost"], true) - assert.Equal(t, b.Params["board_post_new"], true) - assert.Equal(t, b.Params["board_post_edit"], true) - assert.Equal(t, b.Params["board_post_restore"], true) - assert.Equal(t, b.Params["board_post_delete"], true) - assert.Equal(t, b.Params["photo_comment_new"], true) - assert.Equal(t, b.Params["photo_comment_edit"], true) - assert.Equal(t, b.Params["photo_comment_delete"], true) - assert.Equal(t, b.Params["photo_comment_restore"], true) - assert.Equal(t, b.Params["video_comment_new"], true) - assert.Equal(t, b.Params["video_comment_edit"], true) - assert.Equal(t, b.Params["video_comment_delete"], true) - assert.Equal(t, b.Params["video_comment_restore"], true) - assert.Equal(t, b.Params["market_comment_new"], true) - assert.Equal(t, b.Params["market_comment_edit"], true) - assert.Equal(t, b.Params["market_comment_delete"], true) - assert.Equal(t, b.Params["market_comment_restore"], true) - assert.Equal(t, b.Params["market_order_new"], true) - assert.Equal(t, b.Params["market_order_edit"], true) - assert.Equal(t, b.Params["poll_vote_new"], true) - assert.Equal(t, b.Params["group_join"], true) - assert.Equal(t, b.Params["group_leave"], true) - assert.Equal(t, b.Params["group_change_settings"], true) - assert.Equal(t, b.Params["group_change_photo"], true) - assert.Equal(t, b.Params["group_officers_edit"], true) - assert.Equal(t, b.Params["user_block"], true) - assert.Equal(t, b.Params["user_unblock"], true) - assert.Equal(t, b.Params["lead_forms_new"], true) - assert.Equal(t, b.Params["like_add"], true) - assert.Equal(t, b.Params["like_remove"], true) - assert.Equal(t, b.Params["donut_subscription_create"], true) - assert.Equal(t, b.Params["donut_subscription_prolonged"], true) - assert.Equal(t, b.Params["donut_subscription_expired"], true) - assert.Equal(t, b.Params["donut_subscription_cancelled"], true) - assert.Equal(t, b.Params["donut_subscription_price_changed"], true) - assert.Equal(t, b.Params["donut_money_withdraw"], true) - assert.Equal(t, b.Params["donut_money_withdraw_error"], true) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["server_id"]) + assert.Equal(t, "text", b.Params["api_version"]) + assert.Equal(t, true, b.Params["message_new"]) + assert.Equal(t, true, b.Params["message_reply"]) + assert.Equal(t, true, b.Params["message_allow"]) + assert.Equal(t, true, b.Params["message_edit"]) + assert.Equal(t, true, b.Params["message_deny"]) + assert.Equal(t, true, b.Params["message_typing_state"]) + assert.Equal(t, true, b.Params["photo_new"]) + assert.Equal(t, true, b.Params["audio_new"]) + assert.Equal(t, true, b.Params["video_new"]) + assert.Equal(t, true, b.Params["wall_reply_new"]) + assert.Equal(t, true, b.Params["wall_reply_edit"]) + assert.Equal(t, true, b.Params["wall_reply_delete"]) + assert.Equal(t, true, b.Params["wall_reply_restore"]) + assert.Equal(t, true, b.Params["wall_post_new"]) + assert.Equal(t, true, b.Params["wall_repost"]) + assert.Equal(t, true, b.Params["board_post_new"]) + assert.Equal(t, true, b.Params["board_post_edit"]) + assert.Equal(t, true, b.Params["board_post_restore"]) + assert.Equal(t, true, b.Params["board_post_delete"]) + assert.Equal(t, true, b.Params["photo_comment_new"]) + assert.Equal(t, true, b.Params["photo_comment_edit"]) + assert.Equal(t, true, b.Params["photo_comment_delete"]) + assert.Equal(t, true, b.Params["photo_comment_restore"]) + assert.Equal(t, true, b.Params["video_comment_new"]) + assert.Equal(t, true, b.Params["video_comment_edit"]) + assert.Equal(t, true, b.Params["video_comment_delete"]) + assert.Equal(t, true, b.Params["video_comment_restore"]) + assert.Equal(t, true, b.Params["market_comment_new"]) + assert.Equal(t, true, b.Params["market_comment_edit"]) + assert.Equal(t, true, b.Params["market_comment_delete"]) + assert.Equal(t, true, b.Params["market_comment_restore"]) + assert.Equal(t, true, b.Params["market_order_new"]) + assert.Equal(t, true, b.Params["market_order_edit"]) + assert.Equal(t, true, b.Params["poll_vote_new"]) + assert.Equal(t, true, b.Params["group_join"]) + assert.Equal(t, true, b.Params["group_leave"]) + assert.Equal(t, true, b.Params["group_change_settings"]) + assert.Equal(t, true, b.Params["group_change_photo"]) + assert.Equal(t, true, b.Params["group_officers_edit"]) + assert.Equal(t, true, b.Params["user_block"]) + assert.Equal(t, true, b.Params["user_unblock"]) + assert.Equal(t, true, b.Params["lead_forms_new"]) + assert.Equal(t, true, b.Params["like_add"]) + assert.Equal(t, true, b.Params["like_remove"]) + assert.Equal(t, true, b.Params["donut_subscription_create"]) + assert.Equal(t, true, b.Params["donut_subscription_prolonged"]) + assert.Equal(t, true, b.Params["donut_subscription_expired"]) + assert.Equal(t, true, b.Params["donut_subscription_cancelled"]) + assert.Equal(t, true, b.Params["donut_subscription_price_changed"]) + assert.Equal(t, true, b.Params["donut_money_withdraw"]) + assert.Equal(t, true, b.Params["donut_money_withdraw_error"]) } func TestGroupsSetLongPollSettingsBuilder(t *testing.T) { @@ -872,59 +872,59 @@ func TestGroupsSetLongPollSettingsBuilder(t *testing.T) { b.DonutMoneyWithdraw(true) b.DonutMoneyWithdrawError(true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["enabled"], true) - assert.Equal(t, b.Params["api_version"], "text") - assert.Equal(t, b.Params["message_new"], true) - assert.Equal(t, b.Params["message_reply"], true) - assert.Equal(t, b.Params["message_allow"], true) - assert.Equal(t, b.Params["message_deny"], true) - assert.Equal(t, b.Params["message_edit"], true) - assert.Equal(t, b.Params["message_typing_state"], true) - assert.Equal(t, b.Params["photo_new"], true) - assert.Equal(t, b.Params["audio_new"], true) - assert.Equal(t, b.Params["video_new"], true) - assert.Equal(t, b.Params["wall_reply_new"], true) - assert.Equal(t, b.Params["wall_reply_edit"], true) - assert.Equal(t, b.Params["wall_reply_delete"], true) - assert.Equal(t, b.Params["wall_reply_restore"], true) - assert.Equal(t, b.Params["wall_post_new"], true) - assert.Equal(t, b.Params["wall_repost"], true) - assert.Equal(t, b.Params["board_post_new"], true) - assert.Equal(t, b.Params["board_post_edit"], true) - assert.Equal(t, b.Params["board_post_restore"], true) - assert.Equal(t, b.Params["board_post_delete"], true) - assert.Equal(t, b.Params["photo_comment_new"], true) - assert.Equal(t, b.Params["photo_comment_edit"], true) - assert.Equal(t, b.Params["photo_comment_delete"], true) - assert.Equal(t, b.Params["photo_comment_restore"], true) - assert.Equal(t, b.Params["video_comment_new"], true) - assert.Equal(t, b.Params["video_comment_edit"], true) - assert.Equal(t, b.Params["video_comment_delete"], true) - assert.Equal(t, b.Params["video_comment_restore"], true) - assert.Equal(t, b.Params["market_comment_new"], true) - assert.Equal(t, b.Params["market_comment_edit"], true) - assert.Equal(t, b.Params["market_comment_delete"], true) - assert.Equal(t, b.Params["market_comment_restore"], true) - assert.Equal(t, b.Params["market_order_new"], true) - assert.Equal(t, b.Params["market_order_edit"], true) - assert.Equal(t, b.Params["poll_vote_new"], true) - assert.Equal(t, b.Params["group_join"], true) - assert.Equal(t, b.Params["group_leave"], true) - assert.Equal(t, b.Params["group_change_settings"], true) - assert.Equal(t, b.Params["group_change_photo"], true) - assert.Equal(t, b.Params["group_officers_edit"], true) - assert.Equal(t, b.Params["user_block"], true) - assert.Equal(t, b.Params["user_unblock"], true) - assert.Equal(t, b.Params["like_add"], true) - assert.Equal(t, b.Params["like_remove"], true) - assert.Equal(t, b.Params["donut_subscription_create"], true) - assert.Equal(t, b.Params["donut_subscription_prolonged"], true) - assert.Equal(t, b.Params["donut_subscription_expired"], true) - assert.Equal(t, b.Params["donut_subscription_cancelled"], true) - assert.Equal(t, b.Params["donut_subscription_price_changed"], true) - assert.Equal(t, b.Params["donut_money_withdraw"], true) - assert.Equal(t, b.Params["donut_money_withdraw_error"], true) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, true, b.Params["enabled"]) + assert.Equal(t, "text", b.Params["api_version"]) + assert.Equal(t, true, b.Params["message_new"]) + assert.Equal(t, true, b.Params["message_reply"]) + assert.Equal(t, true, b.Params["message_allow"]) + assert.Equal(t, true, b.Params["message_deny"]) + assert.Equal(t, true, b.Params["message_edit"]) + assert.Equal(t, true, b.Params["message_typing_state"]) + assert.Equal(t, true, b.Params["photo_new"]) + assert.Equal(t, true, b.Params["audio_new"]) + assert.Equal(t, true, b.Params["video_new"]) + assert.Equal(t, true, b.Params["wall_reply_new"]) + assert.Equal(t, true, b.Params["wall_reply_edit"]) + assert.Equal(t, true, b.Params["wall_reply_delete"]) + assert.Equal(t, true, b.Params["wall_reply_restore"]) + assert.Equal(t, true, b.Params["wall_post_new"]) + assert.Equal(t, true, b.Params["wall_repost"]) + assert.Equal(t, true, b.Params["board_post_new"]) + assert.Equal(t, true, b.Params["board_post_edit"]) + assert.Equal(t, true, b.Params["board_post_restore"]) + assert.Equal(t, true, b.Params["board_post_delete"]) + assert.Equal(t, true, b.Params["photo_comment_new"]) + assert.Equal(t, true, b.Params["photo_comment_edit"]) + assert.Equal(t, true, b.Params["photo_comment_delete"]) + assert.Equal(t, true, b.Params["photo_comment_restore"]) + assert.Equal(t, true, b.Params["video_comment_new"]) + assert.Equal(t, true, b.Params["video_comment_edit"]) + assert.Equal(t, true, b.Params["video_comment_delete"]) + assert.Equal(t, true, b.Params["video_comment_restore"]) + assert.Equal(t, true, b.Params["market_comment_new"]) + assert.Equal(t, true, b.Params["market_comment_edit"]) + assert.Equal(t, true, b.Params["market_comment_delete"]) + assert.Equal(t, true, b.Params["market_comment_restore"]) + assert.Equal(t, true, b.Params["market_order_new"]) + assert.Equal(t, true, b.Params["market_order_edit"]) + assert.Equal(t, true, b.Params["poll_vote_new"]) + assert.Equal(t, true, b.Params["group_join"]) + assert.Equal(t, true, b.Params["group_leave"]) + assert.Equal(t, true, b.Params["group_change_settings"]) + assert.Equal(t, true, b.Params["group_change_photo"]) + assert.Equal(t, true, b.Params["group_officers_edit"]) + assert.Equal(t, true, b.Params["user_block"]) + assert.Equal(t, true, b.Params["user_unblock"]) + assert.Equal(t, true, b.Params["like_add"]) + assert.Equal(t, true, b.Params["like_remove"]) + assert.Equal(t, true, b.Params["donut_subscription_create"]) + assert.Equal(t, true, b.Params["donut_subscription_prolonged"]) + assert.Equal(t, true, b.Params["donut_subscription_expired"]) + assert.Equal(t, true, b.Params["donut_subscription_cancelled"]) + assert.Equal(t, true, b.Params["donut_subscription_price_changed"]) + assert.Equal(t, true, b.Params["donut_money_withdraw"]) + assert.Equal(t, true, b.Params["donut_money_withdraw_error"]) } func TestGroupsSetUserNoteBuilder(t *testing.T) { @@ -936,9 +936,9 @@ func TestGroupsSetUserNoteBuilder(t *testing.T) { b.UserID(1) b.Note("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["note"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["note"]) } func TestGroupsTagAddBuilder(t *testing.T) { @@ -950,9 +950,9 @@ func TestGroupsTagAddBuilder(t *testing.T) { b.TagName("text") b.TagColor("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["tag_name"], "text") - assert.Equal(t, b.Params["tag_color"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["tag_name"]) + assert.Equal(t, "text", b.Params["tag_color"]) } func TestGroupsTagBindBuilder(t *testing.T) { @@ -965,16 +965,16 @@ func TestGroupsTagBindBuilder(t *testing.T) { b.UserID(1) b.Act("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["tag_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["act"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["tag_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["act"]) b.Bind() - assert.Equal(t, b.Params["act"], "bind") + assert.Equal(t, "bind", b.Params["act"]) b.Unbind() - assert.Equal(t, b.Params["act"], "unbind") + assert.Equal(t, "unbind", b.Params["act"]) } func TestGroupsTagDeleteBuilder(t *testing.T) { @@ -985,8 +985,8 @@ func TestGroupsTagDeleteBuilder(t *testing.T) { b.GroupID(1) b.TagID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["tag_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["tag_id"]) } func TestGroupsTagUpdateBuilder(t *testing.T) { @@ -998,9 +998,9 @@ func TestGroupsTagUpdateBuilder(t *testing.T) { b.TagID(1) b.TagName("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["tag_id"], 1) - assert.Equal(t, b.Params["tag_name"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["tag_id"]) + assert.Equal(t, "text", b.Params["tag_name"]) } func TestGroupsToggleMarketBuilder(t *testing.T) { @@ -1011,8 +1011,8 @@ func TestGroupsToggleMarketBuilder(t *testing.T) { b.GroupID(1) b.State("none") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["state"], params.GroupMarketState("none")) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, params.GroupMarketState("none"), b.Params["state"]) } func TestGroupsUnbanBuilder(t *testing.T) { @@ -1023,6 +1023,6 @@ func TestGroupsUnbanBuilder(t *testing.T) { b.GroupID(1) b.OwnerID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) } diff --git a/api/params/leads_test.go b/api/params/leads_test.go index 9bc2462d..4bc50838 100644 --- a/api/params/leads_test.go +++ b/api/params/leads_test.go @@ -19,12 +19,12 @@ func TestLeadsCheckUserBuilder(t *testing.T) { b.Age(1) b.Country("text") - assert.Equal(t, b.Params["lead_id"], 1) - assert.Equal(t, b.Params["test_result"], 1) - assert.Equal(t, b.Params["test_mode"], true) - assert.Equal(t, b.Params["auto_start"], true) - assert.Equal(t, b.Params["age"], 1) - assert.Equal(t, b.Params["country"], "text") + assert.Equal(t, 1, b.Params["lead_id"]) + assert.Equal(t, 1, b.Params["test_result"]) + assert.Equal(t, true, b.Params["test_mode"]) + assert.Equal(t, true, b.Params["auto_start"]) + assert.Equal(t, 1, b.Params["age"]) + assert.Equal(t, "text", b.Params["country"]) } func TestLeadsCompleteBuilder(t *testing.T) { @@ -36,9 +36,9 @@ func TestLeadsCompleteBuilder(t *testing.T) { b.Secret("text") b.Comment("text") - assert.Equal(t, b.Params["vk_sid"], "text") - assert.Equal(t, b.Params["secret"], "text") - assert.Equal(t, b.Params["comment"], "text") + assert.Equal(t, "text", b.Params["vk_sid"]) + assert.Equal(t, "text", b.Params["secret"]) + assert.Equal(t, "text", b.Params["comment"]) } func TestLeadsGetStatsBuilder(t *testing.T) { @@ -51,10 +51,10 @@ func TestLeadsGetStatsBuilder(t *testing.T) { b.DateStart("text") b.DateEnd("text") - assert.Equal(t, b.Params["lead_id"], 1) - assert.Equal(t, b.Params["secret"], "text") - assert.Equal(t, b.Params["date_start"], "text") - assert.Equal(t, b.Params["date_end"], "text") + assert.Equal(t, 1, b.Params["lead_id"]) + assert.Equal(t, "text", b.Params["secret"]) + assert.Equal(t, "text", b.Params["date_start"]) + assert.Equal(t, "text", b.Params["date_end"]) } func TestLeadsGetUsersBuilder(t *testing.T) { @@ -69,12 +69,12 @@ func TestLeadsGetUsersBuilder(t *testing.T) { b.Status(1) b.Reverse(true) - assert.Equal(t, b.Params["offer_id"], 1) - assert.Equal(t, b.Params["secret"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["status"], 1) - assert.Equal(t, b.Params["reverse"], true) + assert.Equal(t, 1, b.Params["offer_id"]) + assert.Equal(t, "text", b.Params["secret"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["status"]) + assert.Equal(t, true, b.Params["reverse"]) } func TestLeadsMetricHitBuilder(t *testing.T) { @@ -84,7 +84,7 @@ func TestLeadsMetricHitBuilder(t *testing.T) { b.Data("text") - assert.Equal(t, b.Params["data"], "text") + assert.Equal(t, "text", b.Params["data"]) } func TestLeadsStartBuilder(t *testing.T) { @@ -99,10 +99,10 @@ func TestLeadsStartBuilder(t *testing.T) { b.TestMode(true) b.Force(true) - assert.Equal(t, b.Params["lead_id"], 1) - assert.Equal(t, b.Params["secret"], "text") - assert.Equal(t, b.Params["uid"], 1) - assert.Equal(t, b.Params["aid"], 1) - assert.Equal(t, b.Params["test_mode"], true) - assert.Equal(t, b.Params["force"], true) + assert.Equal(t, 1, b.Params["lead_id"]) + assert.Equal(t, "text", b.Params["secret"]) + assert.Equal(t, 1, b.Params["uid"]) + assert.Equal(t, 1, b.Params["aid"]) + assert.Equal(t, true, b.Params["test_mode"]) + assert.Equal(t, true, b.Params["force"]) } diff --git a/api/params/likes_test.go b/api/params/likes_test.go index 7a0e332a..807a3602 100644 --- a/api/params/likes_test.go +++ b/api/params/likes_test.go @@ -18,11 +18,11 @@ func TestLikesAddBuilder(t *testing.T) { b.ReactionID(1) b.AccessKey("text") - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["reaction_id"], 1) - assert.Equal(t, b.Params["access_key"], "text") + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, 1, b.Params["reaction_id"]) + assert.Equal(t, "text", b.Params["access_key"]) } func TestLikesDeleteBuilder(t *testing.T) { @@ -34,9 +34,9 @@ func TestLikesDeleteBuilder(t *testing.T) { b.OwnerID(1) b.ItemID(1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) } func TestLikesGetListBuilder(t *testing.T) { @@ -55,16 +55,16 @@ func TestLikesGetListBuilder(t *testing.T) { b.Count(1) b.SkipOwn(true) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["page_url"], "text") - assert.Equal(t, b.Params["filter"], "text") - assert.Equal(t, b.Params["friends_only"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["skip_own"], true) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, "text", b.Params["page_url"]) + assert.Equal(t, "text", b.Params["filter"]) + assert.Equal(t, 1, b.Params["friends_only"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["skip_own"]) } func TestLikesIsLikedBuilder(t *testing.T) { @@ -77,8 +77,8 @@ func TestLikesIsLikedBuilder(t *testing.T) { b.OwnerID(1) b.ItemID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) } diff --git a/api/params/market_test.go b/api/params/market_test.go index 4b6f660e..fdff89f4 100644 --- a/api/params/market_test.go +++ b/api/params/market_test.go @@ -23,16 +23,16 @@ func TestMarketAddBuilder(t *testing.T) { b.PhotoIDs([]int{1}) b.URL("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["category_id"], 1) - assert.Equal(t, b.Params["price"], 1.1) - assert.Equal(t, b.Params["old_price"], 1.1) - assert.Equal(t, b.Params["deleted"], true) - assert.Equal(t, b.Params["main_photo_id"], 1) - assert.Equal(t, b.Params["photo_ids"], []int{1}) - assert.Equal(t, b.Params["url"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, 1, b.Params["category_id"]) + assert.InEpsilon(t, 1.1, b.Params["price"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["old_price"], 0.1) + assert.Equal(t, true, b.Params["deleted"]) + assert.Equal(t, 1, b.Params["main_photo_id"]) + assert.Equal(t, []int{1}, b.Params["photo_ids"]) + assert.Equal(t, "text", b.Params["url"]) } func TestMarketAddAlbumBuilder(t *testing.T) { @@ -46,11 +46,11 @@ func TestMarketAddAlbumBuilder(t *testing.T) { b.MainAlbum(true) b.IsHidden(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["main_album"], true) - assert.Equal(t, b.Params["is_hidden"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, true, b.Params["main_album"]) + assert.Equal(t, true, b.Params["is_hidden"]) } func TestMarketAddToAlbumBuilder(t *testing.T) { @@ -63,10 +63,10 @@ func TestMarketAddToAlbumBuilder(t *testing.T) { b.ItemIDs(1) b.AlbumIDs([]int{1}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["item_ids"], 1) - assert.Equal(t, b.Params["album_ids"], []int{1}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, 1, b.Params["item_ids"]) + assert.Equal(t, []int{1}, b.Params["album_ids"]) } func TestMarketCreateCommentBuilder(t *testing.T) { @@ -83,14 +83,14 @@ func TestMarketCreateCommentBuilder(t *testing.T) { b.StickerID(1) b.GUID("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["from_group"], true) - assert.Equal(t, b.Params["reply_to_comment"], 1) - assert.Equal(t, b.Params["sticker_id"], 1) - assert.Equal(t, b.Params["guid"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, true, b.Params["from_group"]) + assert.Equal(t, 1, b.Params["reply_to_comment"]) + assert.Equal(t, 1, b.Params["sticker_id"]) + assert.Equal(t, "text", b.Params["guid"]) } func TestMarketDeleteBuilder(t *testing.T) { @@ -101,8 +101,8 @@ func TestMarketDeleteBuilder(t *testing.T) { b.OwnerID(1) b.ItemID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) } func TestMarketDeleteAlbumBuilder(t *testing.T) { @@ -113,8 +113,8 @@ func TestMarketDeleteAlbumBuilder(t *testing.T) { b.OwnerID(1) b.AlbumID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) } func TestMarketDeleteCommentBuilder(t *testing.T) { @@ -125,8 +125,8 @@ func TestMarketDeleteCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestMarketEditBuilder(t *testing.T) { @@ -145,16 +145,16 @@ func TestMarketEditBuilder(t *testing.T) { b.PhotoIDs([]int{1}) b.URL("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["category_id"], 1) - assert.Equal(t, b.Params["price"], 1.1) - assert.Equal(t, b.Params["deleted"], true) - assert.Equal(t, b.Params["main_photo_id"], 1) - assert.Equal(t, b.Params["photo_ids"], []int{1}) - assert.Equal(t, b.Params["url"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, 1, b.Params["category_id"]) + assert.InEpsilon(t, 1.1, b.Params["price"], 0.1) + assert.Equal(t, true, b.Params["deleted"]) + assert.Equal(t, 1, b.Params["main_photo_id"]) + assert.Equal(t, []int{1}, b.Params["photo_ids"]) + assert.Equal(t, "text", b.Params["url"]) } func TestMarketEditOrderBuilder(t *testing.T) { @@ -176,19 +176,19 @@ func TestMarketEditOrderBuilder(t *testing.T) { b.CommentForUser("text") b.ReceiptLink("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["order_id"], 1) - assert.Equal(t, b.Params["merchant_comment"], "text") - assert.Equal(t, b.Params["status"], 1) - assert.Equal(t, b.Params["track_number"], "text") - assert.Equal(t, b.Params["payment_status"], "text") - assert.Equal(t, b.Params["delivery_price"], 1) - assert.Equal(t, b.Params["width"], 1) - assert.Equal(t, b.Params["length"], 1) - assert.Equal(t, b.Params["height"], 1) - assert.Equal(t, b.Params["weight"], 1) - assert.Equal(t, b.Params["comment_for_user"], "text") - assert.Equal(t, b.Params["receipt_link"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["order_id"]) + assert.Equal(t, "text", b.Params["merchant_comment"]) + assert.Equal(t, 1, b.Params["status"]) + assert.Equal(t, "text", b.Params["track_number"]) + assert.Equal(t, "text", b.Params["payment_status"]) + assert.Equal(t, 1, b.Params["delivery_price"]) + assert.Equal(t, 1, b.Params["width"]) + assert.Equal(t, 1, b.Params["length"]) + assert.Equal(t, 1, b.Params["height"]) + assert.Equal(t, 1, b.Params["weight"]) + assert.Equal(t, "text", b.Params["comment_for_user"]) + assert.Equal(t, "text", b.Params["receipt_link"]) } func TestMarketEditAlbumBuilder(t *testing.T) { @@ -203,12 +203,12 @@ func TestMarketEditAlbumBuilder(t *testing.T) { b.MainAlbum(true) b.IsHidden(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["main_album"], true) - assert.Equal(t, b.Params["is_hidden"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, true, b.Params["main_album"]) + assert.Equal(t, true, b.Params["is_hidden"]) } func TestMarketEditCommentBuilder(t *testing.T) { @@ -221,10 +221,10 @@ func TestMarketEditCommentBuilder(t *testing.T) { b.Message("text") b.Attachments([]string{"text"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) } func TestMarketGetBuilder(t *testing.T) { @@ -240,13 +240,13 @@ func TestMarketGetBuilder(t *testing.T) { b.NeedVariants(true) b.WithDisabled(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["need_variants"], true) - assert.Equal(t, b.Params["with_disabled"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["need_variants"]) + assert.Equal(t, true, b.Params["with_disabled"]) } func TestMarketGetAlbumByIDBuilder(t *testing.T) { @@ -258,9 +258,9 @@ func TestMarketGetAlbumByIDBuilder(t *testing.T) { b.AlbumIDs([]int{1}) b.NeedAllItemIDs(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_ids"], []int{1}) - assert.Equal(t, b.Params["need_all_item_ids"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, []int{1}, b.Params["album_ids"]) + assert.Equal(t, true, b.Params["need_all_item_ids"]) } func TestMarketGetAlbumsBuilder(t *testing.T) { @@ -272,9 +272,9 @@ func TestMarketGetAlbumsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestMarketGetByIDBuilder(t *testing.T) { @@ -285,8 +285,8 @@ func TestMarketGetByIDBuilder(t *testing.T) { b.ItemIDs([]string{"text"}) b.Extended(true) - assert.Equal(t, b.Params["item_ids"], []string{"text"}) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, []string{"text"}, b.Params["item_ids"]) + assert.Equal(t, true, b.Params["extended"]) } func TestMarketGetCategoriesBuilder(t *testing.T) { @@ -297,8 +297,8 @@ func TestMarketGetCategoriesBuilder(t *testing.T) { b.Count(1) b.Offset(1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) } func TestMarketGetCommentsBuilder(t *testing.T) { @@ -316,15 +316,15 @@ func TestMarketGetCommentsBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["need_likes"], true) - assert.Equal(t, b.Params["start_comment_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["sort"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, true, b.Params["need_likes"]) + assert.Equal(t, 1, b.Params["start_comment_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["sort"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestMarketGetGroupOrdersBuilder(t *testing.T) { @@ -336,9 +336,9 @@ func TestMarketGetGroupOrdersBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestMarketGetOrderByIDBuilder(t *testing.T) { @@ -350,9 +350,9 @@ func TestMarketGetOrderByIDBuilder(t *testing.T) { b.OrderID(1) b.Extended(true) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["order_id"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["order_id"]) + assert.Equal(t, true, b.Params["extended"]) } func TestMarketGetOrderItemsBuilder(t *testing.T) { @@ -364,9 +364,9 @@ func TestMarketGetOrderItemsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["order_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["order_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestMarketRemoveFromAlbumBuilder(t *testing.T) { @@ -378,9 +378,9 @@ func TestMarketRemoveFromAlbumBuilder(t *testing.T) { b.ItemID(1) b.AlbumIDs([]int{1}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["album_ids"], []int{1}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, []int{1}, b.Params["album_ids"]) } func TestMarketReorderAlbumsBuilder(t *testing.T) { @@ -393,10 +393,10 @@ func TestMarketReorderAlbumsBuilder(t *testing.T) { b.Before(1) b.After(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["before"], 1) - assert.Equal(t, b.Params["after"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["before"]) + assert.Equal(t, 1, b.Params["after"]) } func TestMarketReorderItemsBuilder(t *testing.T) { @@ -410,11 +410,11 @@ func TestMarketReorderItemsBuilder(t *testing.T) { b.Before(1) b.After(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["before"], 1) - assert.Equal(t, b.Params["after"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, 1, b.Params["before"]) + assert.Equal(t, 1, b.Params["after"]) } func TestMarketReportBuilder(t *testing.T) { @@ -426,9 +426,9 @@ func TestMarketReportBuilder(t *testing.T) { b.ItemID(1) b.Reason(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["reason"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, 1, b.Params["reason"]) } func TestMarketReportCommentBuilder(t *testing.T) { @@ -440,9 +440,9 @@ func TestMarketReportCommentBuilder(t *testing.T) { b.CommentID(1) b.Reason(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["reason"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["reason"]) } func TestMarketRestoreBuilder(t *testing.T) { @@ -453,8 +453,8 @@ func TestMarketRestoreBuilder(t *testing.T) { b.OwnerID(1) b.ItemID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) } func TestMarketRestoreCommentBuilder(t *testing.T) { @@ -465,8 +465,8 @@ func TestMarketRestoreCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestMarketSearchBuilder(t *testing.T) { @@ -488,19 +488,19 @@ func TestMarketSearchBuilder(t *testing.T) { b.Status(1) b.NeedVariants(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["price_from"], 1) - assert.Equal(t, b.Params["price_to"], 1) - assert.Equal(t, b.Params["tags"], []int{1}) - assert.Equal(t, b.Params["sort"], 1) - assert.Equal(t, b.Params["rev"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["status"], 1) - assert.Equal(t, b.Params["need_variants"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["price_from"]) + assert.Equal(t, 1, b.Params["price_to"]) + assert.Equal(t, []int{1}, b.Params["tags"]) + assert.Equal(t, 1, b.Params["sort"]) + assert.Equal(t, 1, b.Params["rev"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["status"]) + assert.Equal(t, true, b.Params["need_variants"]) } func TestMarketSearchItemsBuilder(t *testing.T) { @@ -517,12 +517,12 @@ func TestMarketSearchItemsBuilder(t *testing.T) { b.SortBy(1) b.SortDirection(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["category_id"], 1) - assert.Equal(t, b.Params["price_from"], 1) - assert.Equal(t, b.Params["price_to"], 1) - assert.Equal(t, b.Params["sort_by"], 1) - assert.Equal(t, b.Params["sort_direction"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["category_id"]) + assert.Equal(t, 1, b.Params["price_from"]) + assert.Equal(t, 1, b.Params["price_to"]) + assert.Equal(t, 1, b.Params["sort_by"]) + assert.Equal(t, 1, b.Params["sort_direction"]) } diff --git a/api/params/marusia_test.go b/api/params/marusia_test.go index 7a335646..1eb5f4dd 100644 --- a/api/params/marusia_test.go +++ b/api/params/marusia_test.go @@ -16,9 +16,9 @@ func TestMarusiaSavePictureBuilder(t *testing.T) { b.Photo("text") b.Hash("text") - assert.Equal(t, b.Params["server"], 1) - assert.Equal(t, b.Params["photo"], "text") - assert.Equal(t, b.Params["hash"], "text") + assert.Equal(t, 1, b.Params["server"]) + assert.Equal(t, "text", b.Params["photo"]) + assert.Equal(t, "text", b.Params["hash"]) } func TestMarusiaDeletePictureBuilder(t *testing.T) { @@ -28,7 +28,7 @@ func TestMarusiaDeletePictureBuilder(t *testing.T) { b.ID(1) - assert.Equal(t, b.Params["id"], 1) + assert.Equal(t, 1, b.Params["id"]) } func TestMarusiaCreateAudioBuilder(t *testing.T) { @@ -38,7 +38,7 @@ func TestMarusiaCreateAudioBuilder(t *testing.T) { b.AudioMeta("text") - assert.Equal(t, b.Params["audio_meta"], "text") + assert.Equal(t, "text", b.Params["audio_meta"]) } func TestMarusiaDeleteAudioBuilder(t *testing.T) { @@ -48,5 +48,5 @@ func TestMarusiaDeleteAudioBuilder(t *testing.T) { b.ID(1) - assert.Equal(t, b.Params["id"], 1) + assert.Equal(t, 1, b.Params["id"]) } diff --git a/api/params/messages_test.go b/api/params/messages_test.go index 5c88facc..7ae696da 100644 --- a/api/params/messages_test.go +++ b/api/params/messages_test.go @@ -15,8 +15,8 @@ func TestMessagesAddChatUserBuilder(t *testing.T) { b.ChatID(1) b.UserID(1) - assert.Equal(t, b.Params["chat_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["chat_id"]) + assert.Equal(t, 1, b.Params["user_id"]) } func TestMessagesAllowMessagesFromGroupBuilder(t *testing.T) { @@ -27,8 +27,8 @@ func TestMessagesAllowMessagesFromGroupBuilder(t *testing.T) { b.GroupID(1) b.Key("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["key"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["key"]) } func TestMessagesCreateChatBuilder(t *testing.T) { @@ -39,8 +39,8 @@ func TestMessagesCreateChatBuilder(t *testing.T) { b.UserIDs([]int{1}) b.Title("text") - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["title"], "text") + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, "text", b.Params["title"]) } func TestMessagesDeleteBuilder(t *testing.T) { @@ -55,12 +55,12 @@ func TestMessagesDeleteBuilder(t *testing.T) { b.GroupID(1) b.DeleteForAll(true) - assert.Equal(t, b.Params["message_ids"], []int{1}) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["conversation_message_ids"], []int{1}) - assert.Equal(t, b.Params["spam"], true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["delete_for_all"], true) + assert.Equal(t, []int{1}, b.Params["message_ids"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, []int{1}, b.Params["conversation_message_ids"]) + assert.Equal(t, true, b.Params["spam"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, true, b.Params["delete_for_all"]) } func TestMessagesDeleteChatPhotoBuilder(t *testing.T) { @@ -71,8 +71,8 @@ func TestMessagesDeleteChatPhotoBuilder(t *testing.T) { b.ChatID(1) b.GroupID(1) - assert.Equal(t, b.Params["chat_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["chat_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesDeleteConversationBuilder(t *testing.T) { @@ -84,9 +84,9 @@ func TestMessagesDeleteConversationBuilder(t *testing.T) { b.PeerID(1) b.GroupID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesDenyMessagesFromGroupBuilder(t *testing.T) { @@ -96,7 +96,7 @@ func TestMessagesDenyMessagesFromGroupBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesEditBuilder(t *testing.T) { @@ -118,19 +118,19 @@ func TestMessagesEditBuilder(t *testing.T) { b.ConversationMessageID(1) b.DontParseLinks(true) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["message_id"], 1) - assert.Equal(t, b.Params["lat"], 1.1) - assert.Equal(t, b.Params["long"], 1.1) - assert.Equal(t, b.Params["attachment"], "text") - assert.Equal(t, b.Params["keep_forward_messages"], true) - assert.Equal(t, b.Params["keep_snippets"], true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["keyboard"], "text") - assert.Equal(t, b.Params["template"], "text") - assert.Equal(t, b.Params["conversation_message_id"], 1) - assert.Equal(t, b.Params["dont_parse_links"], true) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, 1, b.Params["message_id"]) + assert.InEpsilon(t, 1.1, b.Params["lat"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["long"], 0.1) + assert.Equal(t, "text", b.Params["attachment"]) + assert.Equal(t, true, b.Params["keep_forward_messages"]) + assert.Equal(t, true, b.Params["keep_snippets"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["keyboard"]) + assert.Equal(t, "text", b.Params["template"]) + assert.Equal(t, 1, b.Params["conversation_message_id"]) + assert.Equal(t, true, b.Params["dont_parse_links"]) } func TestMessagesEditChatBuilder(t *testing.T) { @@ -141,8 +141,8 @@ func TestMessagesEditChatBuilder(t *testing.T) { b.ChatID(1) b.Title("text") - assert.Equal(t, b.Params["chat_id"], 1) - assert.Equal(t, b.Params["title"], "text") + assert.Equal(t, 1, b.Params["chat_id"]) + assert.Equal(t, "text", b.Params["title"]) } func TestMessagesForceCallFinishBuilder(t *testing.T) { @@ -152,7 +152,7 @@ func TestMessagesForceCallFinishBuilder(t *testing.T) { b.CallID("text") - assert.Equal(t, b.Params["call_id"], "text") + assert.Equal(t, "text", b.Params["call_id"]) } func TestMessagesGetByConversationMessageIDBuilder(t *testing.T) { @@ -166,11 +166,11 @@ func TestMessagesGetByConversationMessageIDBuilder(t *testing.T) { b.Fields([]string{"test"}) b.GroupID(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["conversation_message_ids"], []int{1}) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, []int{1}, b.Params["conversation_message_ids"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesGetByIDBuilder(t *testing.T) { @@ -184,11 +184,11 @@ func TestMessagesGetByIDBuilder(t *testing.T) { b.Fields([]string{"test"}) b.GroupID(1) - assert.Equal(t, b.Params["message_ids"], []int{1}) - assert.Equal(t, b.Params["preview_length"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, []int{1}, b.Params["message_ids"]) + assert.Equal(t, 1, b.Params["preview_length"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesGetChatPreviewBuilder(t *testing.T) { @@ -200,9 +200,9 @@ func TestMessagesGetChatPreviewBuilder(t *testing.T) { b.Link("text") b.Fields([]string{"test"}) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["link"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, "text", b.Params["link"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestMessagesGetConversationMembersBuilder(t *testing.T) { @@ -214,9 +214,9 @@ func TestMessagesGetConversationMembersBuilder(t *testing.T) { b.Fields([]string{"test"}) b.GroupID(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesGetConversationsBuilder(t *testing.T) { @@ -232,13 +232,13 @@ func TestMessagesGetConversationsBuilder(t *testing.T) { b.Fields([]string{"test"}) b.GroupID(1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["filter"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["start_message_id"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["filter"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["start_message_id"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesGetConversationsByIDBuilder(t *testing.T) { @@ -251,10 +251,10 @@ func TestMessagesGetConversationsByIDBuilder(t *testing.T) { b.Fields([]string{"test"}) b.GroupID(1) - assert.Equal(t, b.Params["peer_ids"], []int{1}) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, []int{1}, b.Params["peer_ids"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesGetHistoryBuilder(t *testing.T) { @@ -272,15 +272,15 @@ func TestMessagesGetHistoryBuilder(t *testing.T) { b.Fields([]string{"test"}) b.GroupID(1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["start_message_id"], 1) - assert.Equal(t, b.Params["rev"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["start_message_id"]) + assert.Equal(t, 1, b.Params["rev"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesGetHistoryAttachmentsBuilder(t *testing.T) { @@ -298,15 +298,15 @@ func TestMessagesGetHistoryAttachmentsBuilder(t *testing.T) { b.PreserveOrder(true) b.MaxForwardsLevel(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["media_type"], "text") - assert.Equal(t, b.Params["start_from"], "text") - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["photo_sizes"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["preserve_order"], true) - assert.Equal(t, b.Params["max_forwards_level"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, "text", b.Params["media_type"]) + assert.Equal(t, "text", b.Params["start_from"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["photo_sizes"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, true, b.Params["preserve_order"]) + assert.Equal(t, 1, b.Params["max_forwards_level"]) } func TestMessagesGetIntentUsersBuilder(t *testing.T) { @@ -322,13 +322,13 @@ func TestMessagesGetIntentUsersBuilder(t *testing.T) { b.NameCase([]string{"test"}) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["intent"], "test") - assert.Equal(t, b.Params["subscribe_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["name_case"], []string{"test"}) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, "test", b.Params["intent"]) + assert.Equal(t, 1, b.Params["subscribe_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["name_case"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestMessagesGetInviteLinkBuilder(t *testing.T) { @@ -340,9 +340,9 @@ func TestMessagesGetInviteLinkBuilder(t *testing.T) { b.Reset(true) b.GroupID(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["reset"], true) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, true, b.Params["reset"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesGetLastActivityBuilder(t *testing.T) { @@ -352,7 +352,7 @@ func TestMessagesGetLastActivityBuilder(t *testing.T) { b.UserID(1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) } func TestMessagesGetLongPollHistoryBuilder(t *testing.T) { @@ -373,18 +373,18 @@ func TestMessagesGetLongPollHistoryBuilder(t *testing.T) { b.LastN(1) b.Credentials(true) - assert.Equal(t, b.Params["ts"], 1) - assert.Equal(t, b.Params["pts"], 1) - assert.Equal(t, b.Params["preview_length"], 1) - assert.Equal(t, b.Params["onlines"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["events_limit"], 1) - assert.Equal(t, b.Params["msgs_limit"], 1) - assert.Equal(t, b.Params["max_msg_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["lp_version"], 1) - assert.Equal(t, b.Params["last_n"], 1) - assert.Equal(t, b.Params["credentials"], true) + assert.Equal(t, 1, b.Params["ts"]) + assert.Equal(t, 1, b.Params["pts"]) + assert.Equal(t, 1, b.Params["preview_length"]) + assert.Equal(t, true, b.Params["onlines"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["events_limit"]) + assert.Equal(t, 1, b.Params["msgs_limit"]) + assert.Equal(t, 1, b.Params["max_msg_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["lp_version"]) + assert.Equal(t, 1, b.Params["last_n"]) + assert.Equal(t, true, b.Params["credentials"]) } func TestMessagesGetLongPollServerBuilder(t *testing.T) { @@ -396,9 +396,9 @@ func TestMessagesGetLongPollServerBuilder(t *testing.T) { b.GroupID(1) b.LpVersion(1) - assert.Equal(t, b.Params["need_pts"], true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["lp_version"], 1) + assert.Equal(t, true, b.Params["need_pts"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["lp_version"]) } func TestMessagesIsMessagesFromGroupAllowedBuilder(t *testing.T) { @@ -409,8 +409,8 @@ func TestMessagesIsMessagesFromGroupAllowedBuilder(t *testing.T) { b.GroupID(1) b.UserID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) } func TestMessagesJoinChatByInviteLinkBuilder(t *testing.T) { @@ -420,7 +420,7 @@ func TestMessagesJoinChatByInviteLinkBuilder(t *testing.T) { b.Link("text") - assert.Equal(t, b.Params["link"], "text") + assert.Equal(t, "text", b.Params["link"]) } func TestMessagesMarkAsAnsweredConversationBuilder(t *testing.T) { @@ -432,9 +432,9 @@ func TestMessagesMarkAsAnsweredConversationBuilder(t *testing.T) { b.Answered(true) b.GroupID(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["answered"], true) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, true, b.Params["answered"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesMarkAsImportantBuilder(t *testing.T) { @@ -445,8 +445,8 @@ func TestMessagesMarkAsImportantBuilder(t *testing.T) { b.MessageIDs([]int{1}) b.Important(1) - assert.Equal(t, b.Params["message_ids"], []int{1}) - assert.Equal(t, b.Params["important"], 1) + assert.Equal(t, []int{1}, b.Params["message_ids"]) + assert.Equal(t, 1, b.Params["important"]) } func TestMessagesMarkAsImportantConversationBuilder(t *testing.T) { @@ -458,9 +458,9 @@ func TestMessagesMarkAsImportantConversationBuilder(t *testing.T) { b.Important(true) b.GroupID(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["important"], true) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, true, b.Params["important"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesMarkAsReadBuilder(t *testing.T) { @@ -473,10 +473,10 @@ func TestMessagesMarkAsReadBuilder(t *testing.T) { b.StartMessageID(1) b.GroupID(1) - assert.Equal(t, b.Params["message_ids"], []int{1}) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["start_message_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, []int{1}, b.Params["message_ids"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["start_message_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesPinBuilder(t *testing.T) { @@ -488,9 +488,9 @@ func TestMessagesPinBuilder(t *testing.T) { b.MessageID(1) b.ConversationMessageID(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["message_id"], 1) - assert.Equal(t, b.Params["conversation_message_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["message_id"]) + assert.Equal(t, 1, b.Params["conversation_message_id"]) } func TestMessagesRemoveChatUserBuilder(t *testing.T) { @@ -502,9 +502,9 @@ func TestMessagesRemoveChatUserBuilder(t *testing.T) { b.UserID(1) b.MemberID(1) - assert.Equal(t, b.Params["chat_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["member_id"], 1) + assert.Equal(t, 1, b.Params["chat_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["member_id"]) } func TestMessagesRestoreBuilder(t *testing.T) { @@ -515,8 +515,8 @@ func TestMessagesRestoreBuilder(t *testing.T) { b.MessageID(1) b.GroupID(1) - assert.Equal(t, b.Params["message_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["message_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesSearchBuilder(t *testing.T) { @@ -534,15 +534,15 @@ func TestMessagesSearchBuilder(t *testing.T) { b.Fields([]string{"text"}) b.GroupID(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["date"], 1) - assert.Equal(t, b.Params["preview_length"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"text"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["date"]) + assert.Equal(t, 1, b.Params["preview_length"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"text"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesSearchConversationsBuilder(t *testing.T) { @@ -556,11 +556,11 @@ func TestMessagesSearchConversationsBuilder(t *testing.T) { b.Fields([]string{"test"}) b.GroupID(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesSendBuilder(t *testing.T) { @@ -593,30 +593,30 @@ func TestMessagesSendBuilder(t *testing.T) { b.Intent("text") b.SubscribeID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["random_id"], 1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["domain"], "text") - assert.Equal(t, b.Params["chat_id"], 1) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["peer_ids"], []int{1}) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["lat"], 1.1) - assert.Equal(t, b.Params["long"], 1.1) - assert.Equal(t, b.Params["attachment"], "text") - assert.Equal(t, b.Params["reply_to"], 1) - assert.Equal(t, b.Params["forward_messages"], []int{1}) - assert.Equal(t, b.Params["forward"], "text") - assert.Equal(t, b.Params["sticker_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["keyboard"], "text") - assert.Equal(t, b.Params["template"], "text") - assert.Equal(t, b.Params["payload"], "text") - assert.Equal(t, b.Params["content_source"], "text") - assert.Equal(t, b.Params["dont_parse_links"], true) - assert.Equal(t, b.Params["disable_mentions"], true) - assert.Equal(t, b.Params["intent"], "text") - assert.Equal(t, b.Params["subscribe_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["random_id"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, "text", b.Params["domain"]) + assert.Equal(t, 1, b.Params["chat_id"]) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, []int{1}, b.Params["peer_ids"]) + assert.Equal(t, "text", b.Params["message"]) + assert.InEpsilon(t, 1.1, b.Params["lat"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["long"], 0.1) + assert.Equal(t, "text", b.Params["attachment"]) + assert.Equal(t, 1, b.Params["reply_to"]) + assert.Equal(t, []int{1}, b.Params["forward_messages"]) + assert.Equal(t, "text", b.Params["forward"]) + assert.Equal(t, 1, b.Params["sticker_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["keyboard"]) + assert.Equal(t, "text", b.Params["template"]) + assert.Equal(t, "text", b.Params["payload"]) + assert.Equal(t, "text", b.Params["content_source"]) + assert.Equal(t, true, b.Params["dont_parse_links"]) + assert.Equal(t, true, b.Params["disable_mentions"]) + assert.Equal(t, "text", b.Params["intent"]) + assert.Equal(t, 1, b.Params["subscribe_id"]) } func TestMessagesSendMessageEventAnswerBuilder(t *testing.T) { @@ -629,10 +629,10 @@ func TestMessagesSendMessageEventAnswerBuilder(t *testing.T) { b.PeerID(1) b.EventData("text") - assert.Equal(t, b.Params["event_id"], "text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["event_data"], "text") + assert.Equal(t, "text", b.Params["event_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, "text", b.Params["event_data"]) } func TestMessagesSetActivityBuilder(t *testing.T) { @@ -645,10 +645,10 @@ func TestMessagesSetActivityBuilder(t *testing.T) { b.PeerID(1) b.GroupID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesSetChatPhotoBuilder(t *testing.T) { @@ -658,7 +658,7 @@ func TestMessagesSetChatPhotoBuilder(t *testing.T) { b.File("text") - assert.Equal(t, b.Params["file"], "text") + assert.Equal(t, "text", b.Params["file"]) } func TestMessagesStartCallBuilder(t *testing.T) { @@ -668,7 +668,7 @@ func TestMessagesStartCallBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestMessagesUnpinBuilder(t *testing.T) { @@ -679,6 +679,6 @@ func TestMessagesUnpinBuilder(t *testing.T) { b.PeerID(1) b.GroupID(1) - assert.Equal(t, b.Params["peer_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } diff --git a/api/params/newsfeed_test.go b/api/params/newsfeed_test.go index 57e1571b..a81ca16a 100644 --- a/api/params/newsfeed_test.go +++ b/api/params/newsfeed_test.go @@ -15,8 +15,8 @@ func TestNewsfeedAddBanBuilder(t *testing.T) { b.UserIDs([]int{1}) b.GroupIDs([]int{1}) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["group_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, []int{1}, b.Params["group_ids"]) } func TestNewsfeedDeleteBanBuilder(t *testing.T) { @@ -27,8 +27,8 @@ func TestNewsfeedDeleteBanBuilder(t *testing.T) { b.UserIDs([]int{1}) b.GroupIDs([]int{1}) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["group_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, []int{1}, b.Params["group_ids"]) } func TestNewsfeedDeleteListBuilder(t *testing.T) { @@ -38,7 +38,7 @@ func TestNewsfeedDeleteListBuilder(t *testing.T) { b.ListID(1) - assert.Equal(t, b.Params["list_id"], 1) + assert.Equal(t, 1, b.Params["list_id"]) } func TestNewsfeedGetBuilder(t *testing.T) { @@ -57,16 +57,16 @@ func TestNewsfeedGetBuilder(t *testing.T) { b.Fields([]string{"test"}) b.Section("text") - assert.Equal(t, b.Params["filters"], []string{"test"}) - assert.Equal(t, b.Params["return_banned"], true) - assert.Equal(t, b.Params["start_time"], 1) - assert.Equal(t, b.Params["end_time"], 1) - assert.Equal(t, b.Params["max_photos"], 1) - assert.Equal(t, b.Params["source_ids"], "text") - assert.Equal(t, b.Params["start_from"], "text") - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["section"], "text") + assert.Equal(t, []string{"test"}, b.Params["filters"]) + assert.Equal(t, true, b.Params["return_banned"]) + assert.Equal(t, 1, b.Params["start_time"]) + assert.Equal(t, 1, b.Params["end_time"]) + assert.Equal(t, 1, b.Params["max_photos"]) + assert.Equal(t, "text", b.Params["source_ids"]) + assert.Equal(t, "text", b.Params["start_from"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["section"]) } func TestNewsfeedGetBannedBuilder(t *testing.T) { @@ -78,9 +78,9 @@ func TestNewsfeedGetBannedBuilder(t *testing.T) { b.Fields([]string{"test"}) b.NameCase("text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } func TestNewsfeedGetCommentsBuilder(t *testing.T) { @@ -97,14 +97,14 @@ func TestNewsfeedGetCommentsBuilder(t *testing.T) { b.StartFrom("text") b.Fields([]string{"test"}) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["filters"], []string{"test"}) - assert.Equal(t, b.Params["reposts"], "text") - assert.Equal(t, b.Params["start_time"], 1) - assert.Equal(t, b.Params["end_time"], 1) - assert.Equal(t, b.Params["last_comments_count"], 1) - assert.Equal(t, b.Params["start_from"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["filters"]) + assert.Equal(t, "text", b.Params["reposts"]) + assert.Equal(t, 1, b.Params["start_time"]) + assert.Equal(t, 1, b.Params["end_time"]) + assert.Equal(t, 1, b.Params["last_comments_count"]) + assert.Equal(t, "text", b.Params["start_from"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestNewsfeedGetListsBuilder(t *testing.T) { @@ -115,8 +115,8 @@ func TestNewsfeedGetListsBuilder(t *testing.T) { b.ListIDs([]int{1}) b.Extended(true) - assert.Equal(t, b.Params["list_ids"], []int{1}) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, []int{1}, b.Params["list_ids"]) + assert.Equal(t, true, b.Params["extended"]) } func TestNewsfeedGetMentionsBuilder(t *testing.T) { @@ -130,11 +130,11 @@ func TestNewsfeedGetMentionsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["start_time"], 1) - assert.Equal(t, b.Params["end_time"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["start_time"]) + assert.Equal(t, 1, b.Params["end_time"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestNewsfeedGetRecommendedBuilder(t *testing.T) { @@ -149,12 +149,12 @@ func TestNewsfeedGetRecommendedBuilder(t *testing.T) { b.Count(1) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["start_time"], 1) - assert.Equal(t, b.Params["end_time"], 1) - assert.Equal(t, b.Params["max_photos"], 1) - assert.Equal(t, b.Params["start_from"], "text") - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["start_time"]) + assert.Equal(t, 1, b.Params["end_time"]) + assert.Equal(t, 1, b.Params["max_photos"]) + assert.Equal(t, "text", b.Params["start_from"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestNewsfeedGetSuggestedSourcesBuilder(t *testing.T) { @@ -167,10 +167,10 @@ func TestNewsfeedGetSuggestedSourcesBuilder(t *testing.T) { b.Shuffle(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["shuffle"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["shuffle"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestNewsfeedIgnoreItemBuilder(t *testing.T) { @@ -182,9 +182,9 @@ func TestNewsfeedIgnoreItemBuilder(t *testing.T) { b.OwnerID(1) b.ItemID(1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) } func TestNewsfeedSaveListBuilder(t *testing.T) { @@ -197,10 +197,10 @@ func TestNewsfeedSaveListBuilder(t *testing.T) { b.SourceIDs([]int{1}) b.NoReposts(true) - assert.Equal(t, b.Params["list_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["source_ids"], []int{1}) - assert.Equal(t, b.Params["no_reposts"], true) + assert.Equal(t, 1, b.Params["list_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, []int{1}, b.Params["source_ids"]) + assert.Equal(t, true, b.Params["no_reposts"]) } func TestNewsfeedSearchBuilder(t *testing.T) { @@ -218,15 +218,15 @@ func TestNewsfeedSearchBuilder(t *testing.T) { b.StartFrom("text") b.Fields([]string{"test"}) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["latitude"], 1.1) - assert.Equal(t, b.Params["longitude"], 1.1) - assert.Equal(t, b.Params["start_time"], 1) - assert.Equal(t, b.Params["end_time"], 1) - assert.Equal(t, b.Params["start_from"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["count"]) + assert.InEpsilon(t, 1.1, b.Params["latitude"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["longitude"], 0.1) + assert.Equal(t, 1, b.Params["start_time"]) + assert.Equal(t, 1, b.Params["end_time"]) + assert.Equal(t, "text", b.Params["start_from"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestNewsfeedUnignoreItemBuilder(t *testing.T) { @@ -239,10 +239,10 @@ func TestNewsfeedUnignoreItemBuilder(t *testing.T) { b.ItemID(1) b.TrackCode("text") - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) - assert.Equal(t, b.Params["track_code"], "text") + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) + assert.Equal(t, "text", b.Params["track_code"]) } func TestNewsfeedUnsubscribeBuilder(t *testing.T) { @@ -254,7 +254,7 @@ func TestNewsfeedUnsubscribeBuilder(t *testing.T) { b.OwnerID(1) b.ItemID(1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["item_id"], 1) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["item_id"]) } diff --git a/api/params/notes_test.go b/api/params/notes_test.go index 4f287d6c..ef97ce2d 100644 --- a/api/params/notes_test.go +++ b/api/params/notes_test.go @@ -17,10 +17,10 @@ func TestNotesAddBuilder(t *testing.T) { b.PrivacyView([]string{"text"}) b.PrivacyComment([]string{"text"}) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["privacy_view"], []string{"text"}) - assert.Equal(t, b.Params["privacy_comment"], []string{"text"}) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_view"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_comment"]) } func TestNotesCreateCommentBuilder(t *testing.T) { @@ -34,11 +34,11 @@ func TestNotesCreateCommentBuilder(t *testing.T) { b.Message("text") b.GUID("text") - assert.Equal(t, b.Params["note_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["reply_to"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["guid"], "text") + assert.Equal(t, 1, b.Params["note_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["reply_to"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, "text", b.Params["guid"]) } func TestNotesDeleteBuilder(t *testing.T) { @@ -48,7 +48,7 @@ func TestNotesDeleteBuilder(t *testing.T) { b.NoteID(1) - assert.Equal(t, b.Params["note_id"], 1) + assert.Equal(t, 1, b.Params["note_id"]) } func TestNotesDeleteCommentBuilder(t *testing.T) { @@ -59,8 +59,8 @@ func TestNotesDeleteCommentBuilder(t *testing.T) { b.CommentID(1) b.OwnerID(1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestNotesEditBuilder(t *testing.T) { @@ -74,11 +74,11 @@ func TestNotesEditBuilder(t *testing.T) { b.PrivacyView([]string{"text"}) b.PrivacyComment([]string{"text"}) - assert.Equal(t, b.Params["note_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["privacy_view"], []string{"text"}) - assert.Equal(t, b.Params["privacy_comment"], []string{"text"}) + assert.Equal(t, 1, b.Params["note_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_view"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_comment"]) } func TestNotesEditCommentBuilder(t *testing.T) { @@ -90,9 +90,9 @@ func TestNotesEditCommentBuilder(t *testing.T) { b.OwnerID(1) b.Message("text") - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["message"], "text") + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["message"]) } func TestNotesGetBuilder(t *testing.T) { @@ -106,11 +106,11 @@ func TestNotesGetBuilder(t *testing.T) { b.Count(1) b.Sort(1) - assert.Equal(t, b.Params["note_ids"], []int{1}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["sort"], 1) + assert.Equal(t, []int{1}, b.Params["note_ids"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["sort"]) } func TestNotesGetByIDBuilder(t *testing.T) { @@ -122,9 +122,9 @@ func TestNotesGetByIDBuilder(t *testing.T) { b.OwnerID(1) b.NeedWiki(true) - assert.Equal(t, b.Params["note_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["need_wiki"], true) + assert.Equal(t, 1, b.Params["note_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, true, b.Params["need_wiki"]) } func TestNotesGetCommentsBuilder(t *testing.T) { @@ -138,11 +138,11 @@ func TestNotesGetCommentsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["note_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["sort"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["note_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["sort"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestNotesRestoreCommentBuilder(t *testing.T) { @@ -153,6 +153,6 @@ func TestNotesRestoreCommentBuilder(t *testing.T) { b.CommentID(1) b.OwnerID(1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) } diff --git a/api/params/notifications_test.go b/api/params/notifications_test.go index 60c50dcf..6671d4dd 100644 --- a/api/params/notifications_test.go +++ b/api/params/notifications_test.go @@ -18,11 +18,11 @@ func TestNotificationsGetBuilder(t *testing.T) { b.StartTime(1) b.EndTime(1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["start_from"], "text") - assert.Equal(t, b.Params["filters"], []string{"text"}) - assert.Equal(t, b.Params["start_time"], 1) - assert.Equal(t, b.Params["end_time"], 1) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["start_from"]) + assert.Equal(t, []string{"text"}, b.Params["filters"]) + assert.Equal(t, 1, b.Params["start_time"]) + assert.Equal(t, 1, b.Params["end_time"]) } func TestNotificationsSendMessageBuilder(t *testing.T) { @@ -36,9 +36,9 @@ func TestNotificationsSendMessageBuilder(t *testing.T) { b.GroupID(1) b.RandomID(1) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["fragment"], "text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["random_id"], int64(1)) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, "text", b.Params["fragment"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, int64(1), b.Params["random_id"]) } diff --git a/api/params/orders_test.go b/api/params/orders_test.go index 91f58d4d..7a659833 100644 --- a/api/params/orders_test.go +++ b/api/params/orders_test.go @@ -16,9 +16,9 @@ func TestOrdersCancelSubscriptionBuilder(t *testing.T) { b.SubscriptionID(1) b.PendingCancel(true) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["subscription_id"], 1) - assert.Equal(t, b.Params["pending_cancel"], true) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["subscription_id"]) + assert.Equal(t, true, b.Params["pending_cancel"]) } func TestOrdersChangeStateBuilder(t *testing.T) { @@ -31,10 +31,10 @@ func TestOrdersChangeStateBuilder(t *testing.T) { b.AppOrderID(1) b.TestMode(true) - assert.Equal(t, b.Params["order_id"], 1) - assert.Equal(t, b.Params["action"], "text") - assert.Equal(t, b.Params["app_order_id"], 1) - assert.Equal(t, b.Params["test_mode"], true) + assert.Equal(t, 1, b.Params["order_id"]) + assert.Equal(t, "text", b.Params["action"]) + assert.Equal(t, 1, b.Params["app_order_id"]) + assert.Equal(t, true, b.Params["test_mode"]) } func TestOrdersGetBuilder(t *testing.T) { @@ -46,9 +46,9 @@ func TestOrdersGetBuilder(t *testing.T) { b.Count(1) b.TestMode(true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["test_mode"], true) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["test_mode"]) } func TestOrdersGetAmountBuilder(t *testing.T) { @@ -59,8 +59,8 @@ func TestOrdersGetAmountBuilder(t *testing.T) { b.UserID(1) b.Votes([]string{"text"}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["votes"], []string{"text"}) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, []string{"text"}, b.Params["votes"]) } func TestOrdersGetByIDBuilder(t *testing.T) { @@ -72,9 +72,9 @@ func TestOrdersGetByIDBuilder(t *testing.T) { b.OrderIDs([]int{1}) b.TestMode(true) - assert.Equal(t, b.Params["order_id"], 1) - assert.Equal(t, b.Params["order_ids"], []int{1}) - assert.Equal(t, b.Params["test_mode"], true) + assert.Equal(t, 1, b.Params["order_id"]) + assert.Equal(t, []int{1}, b.Params["order_ids"]) + assert.Equal(t, true, b.Params["test_mode"]) } func TestOrdersGetUserSubscriptionByIDBuilder(t *testing.T) { @@ -85,8 +85,8 @@ func TestOrdersGetUserSubscriptionByIDBuilder(t *testing.T) { b.UserID(1) b.SubscriptionID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["subscription_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["subscription_id"]) } func TestOrdersGetUserSubscriptionsBuilder(t *testing.T) { @@ -96,7 +96,7 @@ func TestOrdersGetUserSubscriptionsBuilder(t *testing.T) { b.UserID(1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) } func TestOrdersUpdateSubscriptionBuilder(t *testing.T) { @@ -108,7 +108,7 @@ func TestOrdersUpdateSubscriptionBuilder(t *testing.T) { b.SubscriptionID(1) b.Price(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["subscription_id"], 1) - assert.Equal(t, b.Params["price"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["subscription_id"]) + assert.Equal(t, 1, b.Params["price"]) } diff --git a/api/params/pages_test.go b/api/params/pages_test.go index 5f070505..86281daf 100644 --- a/api/params/pages_test.go +++ b/api/params/pages_test.go @@ -14,7 +14,7 @@ func TestPagesClearCacheBuilder(t *testing.T) { b.URL("text") - assert.Equal(t, b.Params["url"], "text") + assert.Equal(t, "text", b.Params["url"]) } func TestPagesGetBuilder(t *testing.T) { @@ -30,13 +30,13 @@ func TestPagesGetBuilder(t *testing.T) { b.NeedSource(true) b.NeedHTML(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["page_id"], 1) - assert.Equal(t, b.Params["global"], true) - assert.Equal(t, b.Params["site_preview"], true) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["need_source"], true) - assert.Equal(t, b.Params["need_html"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["page_id"]) + assert.Equal(t, true, b.Params["global"]) + assert.Equal(t, true, b.Params["site_preview"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, true, b.Params["need_source"]) + assert.Equal(t, true, b.Params["need_html"]) } func TestPagesGetHistoryBuilder(t *testing.T) { @@ -48,9 +48,9 @@ func TestPagesGetHistoryBuilder(t *testing.T) { b.GroupID(1) b.UserID(1) - assert.Equal(t, b.Params["page_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["page_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) } func TestPagesGetTitlesBuilder(t *testing.T) { @@ -60,7 +60,7 @@ func TestPagesGetTitlesBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestPagesGetVersionBuilder(t *testing.T) { @@ -73,10 +73,10 @@ func TestPagesGetVersionBuilder(t *testing.T) { b.UserID(1) b.NeedHTML(true) - assert.Equal(t, b.Params["version_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["need_html"], true) + assert.Equal(t, 1, b.Params["version_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, true, b.Params["need_html"]) } func TestPagesParseWikiBuilder(t *testing.T) { @@ -87,8 +87,8 @@ func TestPagesParseWikiBuilder(t *testing.T) { b.Text("text") b.GroupID(1) - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestPagesSaveBuilder(t *testing.T) { @@ -102,11 +102,11 @@ func TestPagesSaveBuilder(t *testing.T) { b.UserID(1) b.Title("text") - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["page_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["title"], "text") + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, 1, b.Params["page_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["title"]) } func TestPagesSaveAccessBuilder(t *testing.T) { @@ -120,9 +120,9 @@ func TestPagesSaveAccessBuilder(t *testing.T) { b.View(1) b.Edit(1) - assert.Equal(t, b.Params["page_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["view"], 1) - assert.Equal(t, b.Params["edit"], 1) + assert.Equal(t, 1, b.Params["page_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["view"]) + assert.Equal(t, 1, b.Params["edit"]) } diff --git a/api/params/photos_test.go b/api/params/photos_test.go index e21a8a61..bc283460 100644 --- a/api/params/photos_test.go +++ b/api/params/photos_test.go @@ -16,9 +16,9 @@ func TestPhotosConfirmTagBuilder(t *testing.T) { b.PhotoID("text") b.TagID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], "text") - assert.Equal(t, b.Params["tag_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["photo_id"]) + assert.Equal(t, 1, b.Params["tag_id"]) } func TestPhotosCopyBuilder(t *testing.T) { @@ -30,9 +30,9 @@ func TestPhotosCopyBuilder(t *testing.T) { b.PhotoID(1) b.AccessKey("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["access_key"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, "text", b.Params["access_key"]) } func TestPhotosCreateAlbumBuilder(t *testing.T) { @@ -48,13 +48,13 @@ func TestPhotosCreateAlbumBuilder(t *testing.T) { b.UploadByAdminsOnly(true) b.CommentsDisabled(true) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["privacy_view"], []string{"text"}) - assert.Equal(t, b.Params["privacy_comment"], []string{"text"}) - assert.Equal(t, b.Params["upload_by_admins_only"], true) - assert.Equal(t, b.Params["comments_disabled"], true) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_view"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_comment"]) + assert.Equal(t, true, b.Params["upload_by_admins_only"]) + assert.Equal(t, true, b.Params["comments_disabled"]) } func TestPhotosCreateCommentBuilder(t *testing.T) { @@ -72,15 +72,15 @@ func TestPhotosCreateCommentBuilder(t *testing.T) { b.AccessKey("text") b.GUID("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["from_group"], true) - assert.Equal(t, b.Params["reply_to_comment"], 1) - assert.Equal(t, b.Params["sticker_id"], 1) - assert.Equal(t, b.Params["access_key"], "text") - assert.Equal(t, b.Params["guid"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, true, b.Params["from_group"]) + assert.Equal(t, 1, b.Params["reply_to_comment"]) + assert.Equal(t, 1, b.Params["sticker_id"]) + assert.Equal(t, "text", b.Params["access_key"]) + assert.Equal(t, "text", b.Params["guid"]) } func TestPhotosDeleteBuilder(t *testing.T) { @@ -91,8 +91,8 @@ func TestPhotosDeleteBuilder(t *testing.T) { b.OwnerID(1) b.PhotoID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) } func TestPhotosDeleteAlbumBuilder(t *testing.T) { @@ -103,8 +103,8 @@ func TestPhotosDeleteAlbumBuilder(t *testing.T) { b.AlbumID(1) b.GroupID(1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestPhotosDeleteCommentBuilder(t *testing.T) { @@ -115,8 +115,8 @@ func TestPhotosDeleteCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestPhotosEditBuilder(t *testing.T) { @@ -133,14 +133,14 @@ func TestPhotosEditBuilder(t *testing.T) { b.FoursquareID("text") b.DeletePlace(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["caption"], "text") - assert.Equal(t, b.Params["latitude"], 1.1) - assert.Equal(t, b.Params["longitude"], 1.1) - assert.Equal(t, b.Params["place_str"], "text") - assert.Equal(t, b.Params["foursquare_id"], "text") - assert.Equal(t, b.Params["delete_place"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, "text", b.Params["caption"]) + assert.InEpsilon(t, 1.1, b.Params["latitude"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["longitude"], 0.1) + assert.Equal(t, "text", b.Params["place_str"]) + assert.Equal(t, "text", b.Params["foursquare_id"]) + assert.Equal(t, true, b.Params["delete_place"]) } func TestPhotosEditAlbumBuilder(t *testing.T) { @@ -157,14 +157,14 @@ func TestPhotosEditAlbumBuilder(t *testing.T) { b.UploadByAdminsOnly(true) b.CommentsDisabled(true) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["privacy_view"], []string{"text"}) - assert.Equal(t, b.Params["privacy_comment"], []string{"text"}) - assert.Equal(t, b.Params["upload_by_admins_only"], true) - assert.Equal(t, b.Params["comments_disabled"], true) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_view"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_comment"]) + assert.Equal(t, true, b.Params["upload_by_admins_only"]) + assert.Equal(t, true, b.Params["comments_disabled"]) } func TestPhotosEditCommentBuilder(t *testing.T) { @@ -177,10 +177,10 @@ func TestPhotosEditCommentBuilder(t *testing.T) { b.Message("text") b.Attachments([]string{"text"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) } func TestPhotosGetBuilder(t *testing.T) { @@ -199,16 +199,16 @@ func TestPhotosGetBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], "text") - assert.Equal(t, b.Params["photo_ids"], []string{"text"}) - assert.Equal(t, b.Params["rev"], true) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["feed_type"], "text") - assert.Equal(t, b.Params["feed"], 1) - assert.Equal(t, b.Params["photo_sizes"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["album_id"]) + assert.Equal(t, []string{"text"}, b.Params["photo_ids"]) + assert.Equal(t, true, b.Params["rev"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, "text", b.Params["feed_type"]) + assert.Equal(t, 1, b.Params["feed"]) + assert.Equal(t, true, b.Params["photo_sizes"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestPhotosGetAlbumsBuilder(t *testing.T) { @@ -224,13 +224,13 @@ func TestPhotosGetAlbumsBuilder(t *testing.T) { b.NeedCovers(true) b.PhotoSizes(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_ids"], []int{1}) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["need_system"], true) - assert.Equal(t, b.Params["need_covers"], true) - assert.Equal(t, b.Params["photo_sizes"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, []int{1}, b.Params["album_ids"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["need_system"]) + assert.Equal(t, true, b.Params["need_covers"]) + assert.Equal(t, true, b.Params["photo_sizes"]) } func TestPhotosGetAlbumsCountBuilder(t *testing.T) { @@ -241,8 +241,8 @@ func TestPhotosGetAlbumsCountBuilder(t *testing.T) { b.UserID(1) b.GroupID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestPhotosGetAllBuilder(t *testing.T) { @@ -259,14 +259,14 @@ func TestPhotosGetAllBuilder(t *testing.T) { b.NeedHidden(true) b.SkipHidden(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["photo_sizes"], true) - assert.Equal(t, b.Params["no_service_albums"], true) - assert.Equal(t, b.Params["need_hidden"], true) - assert.Equal(t, b.Params["skip_hidden"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["photo_sizes"]) + assert.Equal(t, true, b.Params["no_service_albums"]) + assert.Equal(t, true, b.Params["need_hidden"]) + assert.Equal(t, true, b.Params["skip_hidden"]) } func TestPhotosGetAllCommentsBuilder(t *testing.T) { @@ -280,11 +280,11 @@ func TestPhotosGetAllCommentsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["need_likes"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, true, b.Params["need_likes"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestPhotosGetByIDBuilder(t *testing.T) { @@ -296,9 +296,9 @@ func TestPhotosGetByIDBuilder(t *testing.T) { b.Extended(true) b.PhotoSizes(true) - assert.Equal(t, b.Params["photos"], []string{"text"}) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["photo_sizes"], true) + assert.Equal(t, []string{"text"}, b.Params["photos"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["photo_sizes"]) } func TestPhotosGetChatUploadServerBuilder(t *testing.T) { @@ -311,10 +311,10 @@ func TestPhotosGetChatUploadServerBuilder(t *testing.T) { b.CropY(1) b.CropWidth(1) - assert.Equal(t, b.Params["chat_id"], 1) - assert.Equal(t, b.Params["crop_x"], 1) - assert.Equal(t, b.Params["crop_y"], 1) - assert.Equal(t, b.Params["crop_width"], 1) + assert.Equal(t, 1, b.Params["chat_id"]) + assert.Equal(t, 1, b.Params["crop_x"]) + assert.Equal(t, 1, b.Params["crop_y"]) + assert.Equal(t, 1, b.Params["crop_width"]) } func TestPhotosGetCommentsBuilder(t *testing.T) { @@ -333,16 +333,16 @@ func TestPhotosGetCommentsBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["need_likes"], true) - assert.Equal(t, b.Params["start_comment_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["sort"], "text") - assert.Equal(t, b.Params["access_key"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, true, b.Params["need_likes"]) + assert.Equal(t, 1, b.Params["start_comment_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["sort"]) + assert.Equal(t, "text", b.Params["access_key"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestPhotosGetMarketAlbumUploadServerBuilder(t *testing.T) { @@ -352,7 +352,7 @@ func TestPhotosGetMarketAlbumUploadServerBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestPhotosGetMarketUploadServerBuilder(t *testing.T) { @@ -366,11 +366,11 @@ func TestPhotosGetMarketUploadServerBuilder(t *testing.T) { b.CropY(1) b.CropWidth(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["main_photo"], true) - assert.Equal(t, b.Params["crop_x"], 1) - assert.Equal(t, b.Params["crop_y"], 1) - assert.Equal(t, b.Params["crop_width"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, true, b.Params["main_photo"]) + assert.Equal(t, 1, b.Params["crop_x"]) + assert.Equal(t, 1, b.Params["crop_y"]) + assert.Equal(t, 1, b.Params["crop_width"]) } func TestPhotosGetMessagesUploadServerBuilder(t *testing.T) { @@ -380,7 +380,7 @@ func TestPhotosGetMessagesUploadServerBuilder(t *testing.T) { b.PeerID(1) - assert.Equal(t, b.Params["peer_id"], 1) + assert.Equal(t, 1, b.Params["peer_id"]) } func TestPhotosGetNewTagsBuilder(t *testing.T) { @@ -391,8 +391,8 @@ func TestPhotosGetNewTagsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestPhotosGetOwnerCoverPhotoUploadServerBuilder(t *testing.T) { @@ -406,11 +406,11 @@ func TestPhotosGetOwnerCoverPhotoUploadServerBuilder(t *testing.T) { b.CropX2(1) b.CropY2(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["crop_x"], 1) - assert.Equal(t, b.Params["crop_y"], 1) - assert.Equal(t, b.Params["crop_x2"], 1) - assert.Equal(t, b.Params["crop_y2"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["crop_x"]) + assert.Equal(t, 1, b.Params["crop_y"]) + assert.Equal(t, 1, b.Params["crop_x2"]) + assert.Equal(t, 1, b.Params["crop_y2"]) } func TestPhotosGetOwnerPhotoUploadServerBuilder(t *testing.T) { @@ -420,7 +420,7 @@ func TestPhotosGetOwnerPhotoUploadServerBuilder(t *testing.T) { b.OwnerID(1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestPhotosGetTagsBuilder(t *testing.T) { @@ -432,9 +432,9 @@ func TestPhotosGetTagsBuilder(t *testing.T) { b.PhotoID(1) b.AccessKey("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["access_key"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, "text", b.Params["access_key"]) } func TestPhotosGetUploadServerBuilder(t *testing.T) { @@ -445,8 +445,8 @@ func TestPhotosGetUploadServerBuilder(t *testing.T) { b.GroupID(1) b.AlbumID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["album_id"]) } func TestPhotosGetUserPhotosBuilder(t *testing.T) { @@ -460,11 +460,11 @@ func TestPhotosGetUserPhotosBuilder(t *testing.T) { b.Extended(true) b.Sort("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["sort"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, "text", b.Params["sort"]) } func TestPhotosGetWallUploadServerBuilder(t *testing.T) { @@ -474,7 +474,7 @@ func TestPhotosGetWallUploadServerBuilder(t *testing.T) { b.GroupID(1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) } func TestPhotosMakeCoverBuilder(t *testing.T) { @@ -486,9 +486,9 @@ func TestPhotosMakeCoverBuilder(t *testing.T) { b.PhotoID(1) b.AlbumID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, 1, b.Params["album_id"]) } func TestPhotosMoveBuilder(t *testing.T) { @@ -500,9 +500,9 @@ func TestPhotosMoveBuilder(t *testing.T) { b.TargetAlbumID(1) b.PhotoID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["target_album_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["target_album_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) } func TestPhotosPutTagBuilder(t *testing.T) { @@ -518,13 +518,13 @@ func TestPhotosPutTagBuilder(t *testing.T) { b.X2(1.1) b.Y2(1.1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["x"], 1.1) - assert.Equal(t, b.Params["y"], 1.1) - assert.Equal(t, b.Params["x2"], 1.1) - assert.Equal(t, b.Params["y2"], 1.1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.InEpsilon(t, 1.1, b.Params["x"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["y"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["x2"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["y2"], 0.1) } func TestPhotosRemoveTagBuilder(t *testing.T) { @@ -536,9 +536,9 @@ func TestPhotosRemoveTagBuilder(t *testing.T) { b.PhotoID(1) b.TagID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["tag_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, 1, b.Params["tag_id"]) } func TestPhotosReorderAlbumsBuilder(t *testing.T) { @@ -551,10 +551,10 @@ func TestPhotosReorderAlbumsBuilder(t *testing.T) { b.Before(1) b.After(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["before"], 1) - assert.Equal(t, b.Params["after"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["before"]) + assert.Equal(t, 1, b.Params["after"]) } func TestPhotosReorderPhotosBuilder(t *testing.T) { @@ -567,10 +567,10 @@ func TestPhotosReorderPhotosBuilder(t *testing.T) { b.Before(1) b.After(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["before"], 1) - assert.Equal(t, b.Params["after"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, 1, b.Params["before"]) + assert.Equal(t, 1, b.Params["after"]) } func TestPhotosReportBuilder(t *testing.T) { @@ -582,9 +582,9 @@ func TestPhotosReportBuilder(t *testing.T) { b.PhotoID(1) b.Reason(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["reason"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, 1, b.Params["reason"]) } func TestPhotosReportCommentBuilder(t *testing.T) { @@ -596,9 +596,9 @@ func TestPhotosReportCommentBuilder(t *testing.T) { b.CommentID(1) b.Reason(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["reason"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["reason"]) } func TestPhotosRestoreBuilder(t *testing.T) { @@ -609,8 +609,8 @@ func TestPhotosRestoreBuilder(t *testing.T) { b.OwnerID(1) b.PhotoID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["photo_id"]) } func TestPhotosRestoreCommentBuilder(t *testing.T) { @@ -621,8 +621,8 @@ func TestPhotosRestoreCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestPhotosSaveBuilder(t *testing.T) { @@ -639,14 +639,14 @@ func TestPhotosSaveBuilder(t *testing.T) { b.Longitude(1.1) b.Caption("text") - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["server"], 1) - assert.Equal(t, b.Params["photos_list"], "text") - assert.Equal(t, b.Params["hash"], "text") - assert.Equal(t, b.Params["latitude"], 1.1) - assert.Equal(t, b.Params["longitude"], 1.1) - assert.Equal(t, b.Params["caption"], "text") + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["server"]) + assert.Equal(t, "text", b.Params["photos_list"]) + assert.Equal(t, "text", b.Params["hash"]) + assert.InEpsilon(t, 1.1, b.Params["latitude"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["longitude"], 0.1) + assert.Equal(t, "text", b.Params["caption"]) } func TestPhotosSaveMarketAlbumPhotoBuilder(t *testing.T) { @@ -659,10 +659,10 @@ func TestPhotosSaveMarketAlbumPhotoBuilder(t *testing.T) { b.Server(1) b.Hash("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["photo"], "text") - assert.Equal(t, b.Params["server"], 1) - assert.Equal(t, b.Params["hash"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["photo"]) + assert.Equal(t, 1, b.Params["server"]) + assert.Equal(t, "text", b.Params["hash"]) } func TestPhotosSaveMarketPhotoBuilder(t *testing.T) { @@ -677,12 +677,12 @@ func TestPhotosSaveMarketPhotoBuilder(t *testing.T) { b.CropData("text") b.CropHash("text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["photo"], "text") - assert.Equal(t, b.Params["server"], 1) - assert.Equal(t, b.Params["hash"], "text") - assert.Equal(t, b.Params["crop_data"], "text") - assert.Equal(t, b.Params["crop_hash"], "text") + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["photo"]) + assert.Equal(t, 1, b.Params["server"]) + assert.Equal(t, "text", b.Params["hash"]) + assert.Equal(t, "text", b.Params["crop_data"]) + assert.Equal(t, "text", b.Params["crop_hash"]) } func TestPhotosSaveMessagesPhotoBuilder(t *testing.T) { @@ -694,9 +694,9 @@ func TestPhotosSaveMessagesPhotoBuilder(t *testing.T) { b.Server(1) b.Hash("text") - assert.Equal(t, b.Params["photo"], "text") - assert.Equal(t, b.Params["server"], 1) - assert.Equal(t, b.Params["hash"], "text") + assert.Equal(t, "text", b.Params["photo"]) + assert.Equal(t, 1, b.Params["server"]) + assert.Equal(t, "text", b.Params["hash"]) } func TestPhotosSaveOwnerCoverPhotoBuilder(t *testing.T) { @@ -707,8 +707,8 @@ func TestPhotosSaveOwnerCoverPhotoBuilder(t *testing.T) { b.Hash("text") b.Photo("text") - assert.Equal(t, b.Params["hash"], "text") - assert.Equal(t, b.Params["photo"], "text") + assert.Equal(t, "text", b.Params["hash"]) + assert.Equal(t, "text", b.Params["photo"]) } func TestPhotosSaveOwnerPhotoBuilder(t *testing.T) { @@ -720,9 +720,9 @@ func TestPhotosSaveOwnerPhotoBuilder(t *testing.T) { b.Hash("text") b.Photo("text") - assert.Equal(t, b.Params["server"], "text") - assert.Equal(t, b.Params["hash"], "text") - assert.Equal(t, b.Params["photo"], "text") + assert.Equal(t, "text", b.Params["server"]) + assert.Equal(t, "text", b.Params["hash"]) + assert.Equal(t, "text", b.Params["photo"]) } func TestPhotosSaveWallPhotoBuilder(t *testing.T) { @@ -739,14 +739,14 @@ func TestPhotosSaveWallPhotoBuilder(t *testing.T) { b.Longitude(1.1) b.Caption("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["photo"], "text") - assert.Equal(t, b.Params["server"], 1) - assert.Equal(t, b.Params["hash"], "text") - assert.Equal(t, b.Params["latitude"], 1.1) - assert.Equal(t, b.Params["longitude"], 1.1) - assert.Equal(t, b.Params["caption"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["photo"]) + assert.Equal(t, 1, b.Params["server"]) + assert.Equal(t, "text", b.Params["hash"]) + assert.InEpsilon(t, 1.1, b.Params["latitude"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["longitude"], 0.1) + assert.Equal(t, "text", b.Params["caption"]) } func TestPhotosSearchBuilder(t *testing.T) { @@ -764,13 +764,13 @@ func TestPhotosSearchBuilder(t *testing.T) { b.Count(1) b.Radius(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["lat"], 1.1) - assert.Equal(t, b.Params["long"], 1.1) - assert.Equal(t, b.Params["start_time"], 1) - assert.Equal(t, b.Params["end_time"], 1) - assert.Equal(t, b.Params["sort"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["radius"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.InEpsilon(t, 1.1, b.Params["lat"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["long"], 0.1) + assert.Equal(t, 1, b.Params["start_time"]) + assert.Equal(t, 1, b.Params["end_time"]) + assert.Equal(t, 1, b.Params["sort"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["radius"]) } diff --git a/api/params/polls_test.go b/api/params/polls_test.go index bab8fa08..406a1edf 100644 --- a/api/params/polls_test.go +++ b/api/params/polls_test.go @@ -17,10 +17,10 @@ func TestPollsAddVoteBuilder(t *testing.T) { b.AnswerIDs([]int{1}) b.IsBoard(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["poll_id"], 1) - assert.Equal(t, b.Params["answer_ids"], []int{1}) - assert.Equal(t, b.Params["is_board"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["poll_id"]) + assert.Equal(t, []int{1}, b.Params["answer_ids"]) + assert.Equal(t, true, b.Params["is_board"]) } func TestPollsCreateBuilder(t *testing.T) { @@ -37,14 +37,14 @@ func TestPollsCreateBuilder(t *testing.T) { b.PhotoID(1) b.BackgroundID("text") - assert.Equal(t, b.Params["question"], "text") - assert.Equal(t, b.Params["is_anonymous"], true) - assert.Equal(t, b.Params["is_multiple"], true) - assert.Equal(t, b.Params["end_date"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["add_answers"], "text") - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["background_id"], "text") + assert.Equal(t, "text", b.Params["question"]) + assert.Equal(t, true, b.Params["is_anonymous"]) + assert.Equal(t, true, b.Params["is_multiple"]) + assert.Equal(t, 1, b.Params["end_date"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["add_answers"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, "text", b.Params["background_id"]) } func TestPollsDeleteVoteBuilder(t *testing.T) { @@ -57,10 +57,10 @@ func TestPollsDeleteVoteBuilder(t *testing.T) { b.AnswerID(1) b.IsBoard(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["poll_id"], 1) - assert.Equal(t, b.Params["answer_id"], 1) - assert.Equal(t, b.Params["is_board"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["poll_id"]) + assert.Equal(t, 1, b.Params["answer_id"]) + assert.Equal(t, true, b.Params["is_board"]) } func TestPollsEditBuilder(t *testing.T) { @@ -78,15 +78,15 @@ func TestPollsEditBuilder(t *testing.T) { b.PhotoID(1) b.BackgroundID("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["poll_id"], 1) - assert.Equal(t, b.Params["question"], "text") - assert.Equal(t, b.Params["add_answers"], "text") - assert.Equal(t, b.Params["edit_answers"], "text") - assert.Equal(t, b.Params["delete_answers"], "text") - assert.Equal(t, b.Params["end_date"], 1) - assert.Equal(t, b.Params["photo_id"], 1) - assert.Equal(t, b.Params["background_id"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["poll_id"]) + assert.Equal(t, "text", b.Params["question"]) + assert.Equal(t, "text", b.Params["add_answers"]) + assert.Equal(t, "text", b.Params["edit_answers"]) + assert.Equal(t, "text", b.Params["delete_answers"]) + assert.Equal(t, 1, b.Params["end_date"]) + assert.Equal(t, 1, b.Params["photo_id"]) + assert.Equal(t, "text", b.Params["background_id"]) } func TestPollsGetByIDBuilder(t *testing.T) { @@ -102,13 +102,13 @@ func TestPollsGetByIDBuilder(t *testing.T) { b.Fields([]string{"text"}) b.NameCase("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["is_board"], true) - assert.Equal(t, b.Params["poll_id"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["friends_count"], 1) - assert.Equal(t, b.Params["fields"], []string{"text"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, true, b.Params["is_board"]) + assert.Equal(t, 1, b.Params["poll_id"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["friends_count"]) + assert.Equal(t, []string{"text"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } func TestPollsGetVotersBuilder(t *testing.T) { @@ -126,13 +126,13 @@ func TestPollsGetVotersBuilder(t *testing.T) { b.Fields([]string{"test"}) b.NameCase("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["poll_id"], 1) - assert.Equal(t, b.Params["answer_ids"], []int{1}) - assert.Equal(t, b.Params["is_board"], true) - assert.Equal(t, b.Params["friends_only"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["poll_id"]) + assert.Equal(t, []int{1}, b.Params["answer_ids"]) + assert.Equal(t, true, b.Params["is_board"]) + assert.Equal(t, true, b.Params["friends_only"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } diff --git a/api/params/prettyCards_test.go b/api/params/prettyCards_test.go index 08a56204..1d4b991e 100644 --- a/api/params/prettyCards_test.go +++ b/api/params/prettyCards_test.go @@ -20,13 +20,13 @@ func TestPrettyCardsCreateBuilder(t *testing.T) { b.PriceOld("text") b.Button("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["photo"], "text") - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["link"], "text") - assert.Equal(t, b.Params["price"], "text") - assert.Equal(t, b.Params["price_old"], "text") - assert.Equal(t, b.Params["button"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["photo"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["link"]) + assert.Equal(t, "text", b.Params["price"]) + assert.Equal(t, "text", b.Params["price_old"]) + assert.Equal(t, "text", b.Params["button"]) } func TestPrettyCardsDeleteBuilder(t *testing.T) { @@ -37,8 +37,8 @@ func TestPrettyCardsDeleteBuilder(t *testing.T) { b.OwnerID(1) b.CardID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["card_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["card_id"]) } func TestPrettyCardsEditBuilder(t *testing.T) { @@ -55,14 +55,14 @@ func TestPrettyCardsEditBuilder(t *testing.T) { b.PriceOld("text") b.Button("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["card_id"], 1) - assert.Equal(t, b.Params["photo"], "text") - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["link"], "text") - assert.Equal(t, b.Params["price"], "text") - assert.Equal(t, b.Params["price_old"], "text") - assert.Equal(t, b.Params["button"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["card_id"]) + assert.Equal(t, "text", b.Params["photo"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, "text", b.Params["link"]) + assert.Equal(t, "text", b.Params["price"]) + assert.Equal(t, "text", b.Params["price_old"]) + assert.Equal(t, "text", b.Params["button"]) } func TestPrettyCardsGetBuilder(t *testing.T) { @@ -74,9 +74,9 @@ func TestPrettyCardsGetBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestPrettyCardsGetByIDBuilder(t *testing.T) { @@ -87,6 +87,6 @@ func TestPrettyCardsGetByIDBuilder(t *testing.T) { b.OwnerID(1) b.CardIDs([]int{1}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["card_ids"], []int{1}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, []int{1}, b.Params["card_ids"]) } diff --git a/api/params/search_test.go b/api/params/search_test.go index 9d9128b9..cd42e47f 100644 --- a/api/params/search_test.go +++ b/api/params/search_test.go @@ -19,10 +19,10 @@ func TestSearchGetHintsBuilder(t *testing.T) { b.Fields([]string{"text"}) b.SearchGlobal(true) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["limit"], 1) - assert.Equal(t, b.Params["filters"], []string{"text"}) - assert.Equal(t, b.Params["fields"], []string{"text"}) - assert.Equal(t, b.Params["search_global"], true) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["limit"]) + assert.Equal(t, []string{"text"}, b.Params["filters"]) + assert.Equal(t, []string{"text"}, b.Params["fields"]) + assert.Equal(t, true, b.Params["search_global"]) } diff --git a/api/params/secure_test.go b/api/params/secure_test.go index 10637170..f172e2d0 100644 --- a/api/params/secure_test.go +++ b/api/params/secure_test.go @@ -16,9 +16,9 @@ func TestSecureAddAppEventBuilder(t *testing.T) { b.ActivityID(1) b.Value(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["activity_id"], 1) - assert.Equal(t, b.Params["value"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["activity_id"]) + assert.Equal(t, 1, b.Params["value"]) } func TestSecureCheckTokenBuilder(t *testing.T) { @@ -29,8 +29,8 @@ func TestSecureCheckTokenBuilder(t *testing.T) { b.Token("text") b.IP("text") - assert.Equal(t, b.Params["token"], "text") - assert.Equal(t, b.Params["ip"], "text") + assert.Equal(t, "text", b.Params["token"]) + assert.Equal(t, "text", b.Params["ip"]) } func TestSecureGetSMSHistoryBuilder(t *testing.T) { @@ -43,10 +43,10 @@ func TestSecureGetSMSHistoryBuilder(t *testing.T) { b.DateTo(1) b.Limit(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["date_from"], 1) - assert.Equal(t, b.Params["date_to"], 1) - assert.Equal(t, b.Params["limit"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["date_from"]) + assert.Equal(t, 1, b.Params["date_to"]) + assert.Equal(t, 1, b.Params["limit"]) } func TestSecureGetTransactionsHistoryBuilder(t *testing.T) { @@ -61,12 +61,12 @@ func TestSecureGetTransactionsHistoryBuilder(t *testing.T) { b.DateTo(1) b.Limit(1) - assert.Equal(t, b.Params["type"], 1) - assert.Equal(t, b.Params["uid_from"], 1) - assert.Equal(t, b.Params["uid_to"], 1) - assert.Equal(t, b.Params["date_from"], 1) - assert.Equal(t, b.Params["date_to"], 1) - assert.Equal(t, b.Params["limit"], 1) + assert.Equal(t, 1, b.Params["type"]) + assert.Equal(t, 1, b.Params["uid_from"]) + assert.Equal(t, 1, b.Params["uid_to"]) + assert.Equal(t, 1, b.Params["date_from"]) + assert.Equal(t, 1, b.Params["date_to"]) + assert.Equal(t, 1, b.Params["limit"]) } func TestSecureGetUserLevelBuilder(t *testing.T) { @@ -76,7 +76,7 @@ func TestSecureGetUserLevelBuilder(t *testing.T) { b.UserIDs([]int{1}) - assert.Equal(t, b.Params["user_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["user_ids"]) } func TestSecureGiveEventStickerBuilder(t *testing.T) { @@ -87,8 +87,8 @@ func TestSecureGiveEventStickerBuilder(t *testing.T) { b.UserIDs([]int{1}) b.AchievementID(1) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["achievement_id"], 1) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, 1, b.Params["achievement_id"]) } func TestSecureSendNotificationBuilder(t *testing.T) { @@ -100,9 +100,9 @@ func TestSecureSendNotificationBuilder(t *testing.T) { b.UserID(1) b.Message("text") - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["message"], "text") + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["message"]) } func TestSecureSendSMSNotificationBuilder(t *testing.T) { @@ -113,8 +113,8 @@ func TestSecureSendSMSNotificationBuilder(t *testing.T) { b.UserID(1) b.Message("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["message"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["message"]) } func TestSecureSetCounterBuilder(t *testing.T) { @@ -127,8 +127,8 @@ func TestSecureSetCounterBuilder(t *testing.T) { b.Counter(1) b.Increment(true) - assert.Equal(t, b.Params["counters"], []string{"text"}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["counter"], 1) - assert.Equal(t, b.Params["increment"], true) + assert.Equal(t, []string{"text"}, b.Params["counters"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["counter"]) + assert.Equal(t, true, b.Params["increment"]) } diff --git a/api/params/stats_test.go b/api/params/stats_test.go index 881a2970..970333cc 100644 --- a/api/params/stats_test.go +++ b/api/params/stats_test.go @@ -22,15 +22,15 @@ func TestStatsGetBuilder(t *testing.T) { b.StatsGroups([]string{"text"}) b.Extended(true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["app_id"], 1) - assert.Equal(t, b.Params["timestamp_from"], 1) - assert.Equal(t, b.Params["timestamp_to"], 1) - assert.Equal(t, b.Params["interval"], "text") - assert.Equal(t, b.Params["intervals_count"], 1) - assert.Equal(t, b.Params["filters"], []string{"text"}) - assert.Equal(t, b.Params["stats_groups"], []string{"text"}) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["app_id"]) + assert.Equal(t, 1, b.Params["timestamp_from"]) + assert.Equal(t, 1, b.Params["timestamp_to"]) + assert.Equal(t, "text", b.Params["interval"]) + assert.Equal(t, 1, b.Params["intervals_count"]) + assert.Equal(t, []string{"text"}, b.Params["filters"]) + assert.Equal(t, []string{"text"}, b.Params["stats_groups"]) + assert.Equal(t, true, b.Params["extended"]) } func TestStatsGetPostReachBuilder(t *testing.T) { @@ -41,8 +41,8 @@ func TestStatsGetPostReachBuilder(t *testing.T) { b.OwnerID("text") b.PostID(1) - assert.Equal(t, b.Params["owner_id"], "text") - assert.Equal(t, b.Params["post_id"], 1) + assert.Equal(t, "text", b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) } func TestStatsTrackVisitorBuilder(t *testing.T) { @@ -52,5 +52,5 @@ func TestStatsTrackVisitorBuilder(t *testing.T) { b.ID("text") - assert.Equal(t, b.Params["id"], "text") + assert.Equal(t, "text", b.Params["id"]) } diff --git a/api/params/status_test.go b/api/params/status_test.go index 46e0c22c..c3c4e87c 100644 --- a/api/params/status_test.go +++ b/api/params/status_test.go @@ -15,8 +15,8 @@ func TestStatusGetBuilder(t *testing.T) { b.UserID(1) b.GroupID(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestStatusSetBuilder(t *testing.T) { @@ -27,6 +27,6 @@ func TestStatusSetBuilder(t *testing.T) { b.Text("text") b.GroupID(1) - assert.Equal(t, b.Params["text"], "text") - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, "text", b.Params["text"]) + assert.Equal(t, 1, b.Params["group_id"]) } diff --git a/api/params/storage_test.go b/api/params/storage_test.go index 94b5711e..a241c8d1 100644 --- a/api/params/storage_test.go +++ b/api/params/storage_test.go @@ -17,10 +17,10 @@ func TestStorageGetBuilder(t *testing.T) { b.UserID(1) b.Global(true) - assert.Equal(t, b.Params["key"], "text") - assert.Equal(t, b.Params["keys"], []string{"text"}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["global"], true) + assert.Equal(t, "text", b.Params["key"]) + assert.Equal(t, []string{"text"}, b.Params["keys"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, true, b.Params["global"]) } func TestStorageGetKeysBuilder(t *testing.T) { @@ -33,10 +33,10 @@ func TestStorageGetKeysBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["global"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, true, b.Params["global"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestStorageSetBuilder(t *testing.T) { @@ -49,8 +49,8 @@ func TestStorageSetBuilder(t *testing.T) { b.UserID(1) b.Global(true) - assert.Equal(t, b.Params["key"], "text") - assert.Equal(t, b.Params["value"], "text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["global"], true) + assert.Equal(t, "text", b.Params["key"]) + assert.Equal(t, "text", b.Params["value"]) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, true, b.Params["global"]) } diff --git a/api/params/stories_test.go b/api/params/stories_test.go index 22057979..d204c6a8 100644 --- a/api/params/stories_test.go +++ b/api/params/stories_test.go @@ -14,7 +14,7 @@ func TestStoriesBanOwnerBuilder(t *testing.T) { b.OwnersIDs([]int{1}) - assert.Equal(t, b.Params["owners_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["owners_ids"]) } func TestStoriesDeleteBuilder(t *testing.T) { @@ -25,8 +25,8 @@ func TestStoriesDeleteBuilder(t *testing.T) { b.OwnerID(1) b.StoryID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["story_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["story_id"]) } func TestStoriesGetBuilder(t *testing.T) { @@ -37,8 +37,8 @@ func TestStoriesGetBuilder(t *testing.T) { b.OwnerID(1) b.Extended(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, true, b.Params["extended"]) } func TestStoriesGetBannedBuilder(t *testing.T) { @@ -49,8 +49,8 @@ func TestStoriesGetBannedBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestStoriesGetByIDBuilder(t *testing.T) { @@ -62,9 +62,9 @@ func TestStoriesGetByIDBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["stories"], []string{"text"}) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, []string{"text"}, b.Params["stories"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestStoriesGetPhotoUploadServerBuilder(t *testing.T) { @@ -79,12 +79,12 @@ func TestStoriesGetPhotoUploadServerBuilder(t *testing.T) { b.LinkURL("text") b.GroupID(1) - assert.Equal(t, b.Params["add_to_news"], true) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["reply_to_story"], "text") - assert.Equal(t, b.Params["link_text"], "text") - assert.Equal(t, b.Params["link_url"], "text") - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, true, b.Params["add_to_news"]) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, "text", b.Params["reply_to_story"]) + assert.Equal(t, "text", b.Params["link_text"]) + assert.Equal(t, "text", b.Params["link_url"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestStoriesGetRepliesBuilder(t *testing.T) { @@ -98,11 +98,11 @@ func TestStoriesGetRepliesBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["story_id"], 1) - assert.Equal(t, b.Params["access_key"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["story_id"]) + assert.Equal(t, "text", b.Params["access_key"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestStoriesGetStatsBuilder(t *testing.T) { @@ -113,8 +113,8 @@ func TestStoriesGetStatsBuilder(t *testing.T) { b.OwnerID(1) b.StoryID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["story_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["story_id"]) } func TestStoriesGetVideoUploadServerBuilder(t *testing.T) { @@ -129,12 +129,12 @@ func TestStoriesGetVideoUploadServerBuilder(t *testing.T) { b.LinkURL("text") b.GroupID(1) - assert.Equal(t, b.Params["add_to_news"], true) - assert.Equal(t, b.Params["user_ids"], []int{1}) - assert.Equal(t, b.Params["reply_to_story"], "text") - assert.Equal(t, b.Params["link_text"], "text") - assert.Equal(t, b.Params["link_url"], "text") - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, true, b.Params["add_to_news"]) + assert.Equal(t, []int{1}, b.Params["user_ids"]) + assert.Equal(t, "text", b.Params["reply_to_story"]) + assert.Equal(t, "text", b.Params["link_text"]) + assert.Equal(t, "text", b.Params["link_url"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestStoriesGetViewersBuilder(t *testing.T) { @@ -148,11 +148,11 @@ func TestStoriesGetViewersBuilder(t *testing.T) { b.Offset(1) b.Extended(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["story_id"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["story_id"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, true, b.Params["extended"]) } func TestStoriesHideAllRepliesBuilder(t *testing.T) { @@ -163,8 +163,8 @@ func TestStoriesHideAllRepliesBuilder(t *testing.T) { b.OwnerID(1) b.GroupID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["group_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["group_id"]) } func TestStoriesHideReplyBuilder(t *testing.T) { @@ -175,8 +175,8 @@ func TestStoriesHideReplyBuilder(t *testing.T) { b.OwnerID(1) b.StoryID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["story_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["story_id"]) } func TestStoriesSaveBuilder(t *testing.T) { @@ -186,7 +186,7 @@ func TestStoriesSaveBuilder(t *testing.T) { b.UploadResults("test") - assert.Equal(t, b.Params["upload_results"], "test") + assert.Equal(t, "test", b.Params["upload_results"]) } func TestStoriesUnbanOwnerBuilder(t *testing.T) { @@ -196,7 +196,7 @@ func TestStoriesUnbanOwnerBuilder(t *testing.T) { b.OwnersIDs([]int{1}) - assert.Equal(t, b.Params["owners_ids"], []int{1}) + assert.Equal(t, []int{1}, b.Params["owners_ids"]) } func TestStoriesSendInteractionBuilder(t *testing.T) { @@ -210,9 +210,9 @@ func TestStoriesSendInteractionBuilder(t *testing.T) { b.IsAnonymous(true) b.UnseenMarker(true) - assert.Equal(t, b.Params["access_key"], "text") - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["is_broadcast"], true) - assert.Equal(t, b.Params["is_anonymous"], true) - assert.Equal(t, b.Params["unseen_marker"], true) + assert.Equal(t, "text", b.Params["access_key"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, true, b.Params["is_broadcast"]) + assert.Equal(t, true, b.Params["is_anonymous"]) + assert.Equal(t, true, b.Params["unseen_marker"]) } diff --git a/api/params/streaming_test.go b/api/params/streaming_test.go index f206902a..c06e94e9 100644 --- a/api/params/streaming_test.go +++ b/api/params/streaming_test.go @@ -14,5 +14,5 @@ func TestStreamingSetSettingsBuilder(t *testing.T) { b.MonthlyTier("text") - assert.Equal(t, b.Params["monthly_tier"], "text") + assert.Equal(t, "text", b.Params["monthly_tier"]) } diff --git a/api/params/users_test.go b/api/params/users_test.go index af6f6d8c..5635064f 100644 --- a/api/params/users_test.go +++ b/api/params/users_test.go @@ -16,9 +16,9 @@ func TestUsersGetBuilder(t *testing.T) { b.Fields([]string{"test"}) b.NameCase("text") - assert.Equal(t, b.Params["user_ids"], []string{"text"}) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, []string{"text"}, b.Params["user_ids"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } func TestUsersGetFollowersBuilder(t *testing.T) { @@ -32,11 +32,11 @@ func TestUsersGetFollowersBuilder(t *testing.T) { b.Fields([]string{"test"}) b.NameCase("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["name_case"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, "text", b.Params["name_case"]) } func TestUsersGetSubscriptionsBuilder(t *testing.T) { @@ -50,11 +50,11 @@ func TestUsersGetSubscriptionsBuilder(t *testing.T) { b.Count(1) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestUsersIsAppUserBuilder(t *testing.T) { @@ -64,7 +64,7 @@ func TestUsersIsAppUserBuilder(t *testing.T) { b.UserID(1) - assert.Equal(t, b.Params["user_id"], 1) + assert.Equal(t, 1, b.Params["user_id"]) } func TestUsersReportBuilder(t *testing.T) { @@ -76,9 +76,9 @@ func TestUsersReportBuilder(t *testing.T) { b.Type("text") b.Comment("text") - assert.Equal(t, b.Params["user_id"], 1) - assert.Equal(t, b.Params["type"], "text") - assert.Equal(t, b.Params["comment"], "text") + assert.Equal(t, 1, b.Params["user_id"]) + assert.Equal(t, "text", b.Params["type"]) + assert.Equal(t, "text", b.Params["comment"]) } func TestUsersSearchBuilder(t *testing.T) { @@ -120,37 +120,37 @@ func TestUsersSearchBuilder(t *testing.T) { b.GroupID(1) b.FromList([]string{"text"}) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["sort"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["city"], 1) - assert.Equal(t, b.Params["country"], 1) - assert.Equal(t, b.Params["hometown"], "text") - assert.Equal(t, b.Params["university_country"], 1) - assert.Equal(t, b.Params["university"], 1) - assert.Equal(t, b.Params["university_year"], 1) - assert.Equal(t, b.Params["university_faculty"], 1) - assert.Equal(t, b.Params["university_chair"], 1) - assert.Equal(t, b.Params["sex"], 1) - assert.Equal(t, b.Params["status"], 1) - assert.Equal(t, b.Params["age_from"], 1) - assert.Equal(t, b.Params["age_to"], 1) - assert.Equal(t, b.Params["birth_day"], 1) - assert.Equal(t, b.Params["birth_month"], 1) - assert.Equal(t, b.Params["birth_year"], 1) - assert.Equal(t, b.Params["online"], true) - assert.Equal(t, b.Params["has_photo"], true) - assert.Equal(t, b.Params["school_country"], 1) - assert.Equal(t, b.Params["school_city"], 1) - assert.Equal(t, b.Params["school_class"], 1) - assert.Equal(t, b.Params["school"], 1) - assert.Equal(t, b.Params["school_year"], 1) - assert.Equal(t, b.Params["religion"], "text") - assert.Equal(t, b.Params["interests"], "text") - assert.Equal(t, b.Params["company"], "text") - assert.Equal(t, b.Params["position"], "text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["from_list"], []string{"text"}) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["sort"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["city"]) + assert.Equal(t, 1, b.Params["country"]) + assert.Equal(t, "text", b.Params["hometown"]) + assert.Equal(t, 1, b.Params["university_country"]) + assert.Equal(t, 1, b.Params["university"]) + assert.Equal(t, 1, b.Params["university_year"]) + assert.Equal(t, 1, b.Params["university_faculty"]) + assert.Equal(t, 1, b.Params["university_chair"]) + assert.Equal(t, 1, b.Params["sex"]) + assert.Equal(t, 1, b.Params["status"]) + assert.Equal(t, 1, b.Params["age_from"]) + assert.Equal(t, 1, b.Params["age_to"]) + assert.Equal(t, 1, b.Params["birth_day"]) + assert.Equal(t, 1, b.Params["birth_month"]) + assert.Equal(t, 1, b.Params["birth_year"]) + assert.Equal(t, true, b.Params["online"]) + assert.Equal(t, true, b.Params["has_photo"]) + assert.Equal(t, 1, b.Params["school_country"]) + assert.Equal(t, 1, b.Params["school_city"]) + assert.Equal(t, 1, b.Params["school_class"]) + assert.Equal(t, 1, b.Params["school"]) + assert.Equal(t, 1, b.Params["school_year"]) + assert.Equal(t, "text", b.Params["religion"]) + assert.Equal(t, "text", b.Params["interests"]) + assert.Equal(t, "text", b.Params["company"]) + assert.Equal(t, "text", b.Params["position"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, []string{"text"}, b.Params["from_list"]) } diff --git a/api/params/utils_test.go b/api/params/utils_test.go index 7fa7d1c5..5f7cafc6 100644 --- a/api/params/utils_test.go +++ b/api/params/utils_test.go @@ -14,7 +14,7 @@ func TestUtilsCheckLinkBuilder(t *testing.T) { b.URL("text") - assert.Equal(t, b.Params["url"], "text") + assert.Equal(t, "text", b.Params["url"]) } func TestUtilsDeleteFromLastShortenedBuilder(t *testing.T) { @@ -24,7 +24,7 @@ func TestUtilsDeleteFromLastShortenedBuilder(t *testing.T) { b.Key("text") - assert.Equal(t, b.Params["key"], "text") + assert.Equal(t, "text", b.Params["key"]) } func TestUtilsGetLastShortenedLinksBuilder(t *testing.T) { @@ -35,8 +35,8 @@ func TestUtilsGetLastShortenedLinksBuilder(t *testing.T) { b.Count(1) b.Offset(1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) } func TestUtilsGetLinkStatsBuilder(t *testing.T) { @@ -51,12 +51,12 @@ func TestUtilsGetLinkStatsBuilder(t *testing.T) { b.IntervalsCount(1) b.Extended(true) - assert.Equal(t, b.Params["key"], "text") - assert.Equal(t, b.Params["source"], "text") - assert.Equal(t, b.Params["access_key"], "text") - assert.Equal(t, b.Params["interval"], "text") - assert.Equal(t, b.Params["intervals_count"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, "text", b.Params["key"]) + assert.Equal(t, "text", b.Params["source"]) + assert.Equal(t, "text", b.Params["access_key"]) + assert.Equal(t, "text", b.Params["interval"]) + assert.Equal(t, 1, b.Params["intervals_count"]) + assert.Equal(t, true, b.Params["extended"]) } func TestUtilsGetShortLinkBuilder(t *testing.T) { @@ -67,8 +67,8 @@ func TestUtilsGetShortLinkBuilder(t *testing.T) { b.URL("text") b.Private(true) - assert.Equal(t, b.Params["url"], "text") - assert.Equal(t, b.Params["private"], true) + assert.Equal(t, "text", b.Params["url"]) + assert.Equal(t, true, b.Params["private"]) } func TestUtilsResolveScreenNameBuilder(t *testing.T) { @@ -78,5 +78,5 @@ func TestUtilsResolveScreenNameBuilder(t *testing.T) { b.ScreenName("text") - assert.Equal(t, b.Params["screen_name"], "text") + assert.Equal(t, "text", b.Params["screen_name"]) } diff --git a/api/params/video_test.go b/api/params/video_test.go index d2738834..030e0fdb 100644 --- a/api/params/video_test.go +++ b/api/params/video_test.go @@ -16,9 +16,9 @@ func TestVideoAddBuilder(t *testing.T) { b.VideoID(1) b.OwnerID(1) - assert.Equal(t, b.Params["target_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["target_id"]) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestVideoAddAlbumBuilder(t *testing.T) { @@ -30,9 +30,9 @@ func TestVideoAddAlbumBuilder(t *testing.T) { b.Title("text") b.Privacy([]string{"text"}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["privacy"], []string{"text"}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, []string{"text"}, b.Params["privacy"]) } func TestVideoAddToAlbumBuilder(t *testing.T) { @@ -46,11 +46,11 @@ func TestVideoAddToAlbumBuilder(t *testing.T) { b.OwnerID(1) b.VideoID(1) - assert.Equal(t, b.Params["target_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["album_ids"], []int{1}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) + assert.Equal(t, 1, b.Params["target_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, []int{1}, b.Params["album_ids"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) } func TestVideoCreateCommentBuilder(t *testing.T) { @@ -67,14 +67,14 @@ func TestVideoCreateCommentBuilder(t *testing.T) { b.StickerID(1) b.GUID("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["from_group"], true) - assert.Equal(t, b.Params["reply_to_comment"], 1) - assert.Equal(t, b.Params["sticker_id"], 1) - assert.Equal(t, b.Params["guid"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, true, b.Params["from_group"]) + assert.Equal(t, 1, b.Params["reply_to_comment"]) + assert.Equal(t, 1, b.Params["sticker_id"]) + assert.Equal(t, "text", b.Params["guid"]) } func TestVideoDeleteBuilder(t *testing.T) { @@ -86,9 +86,9 @@ func TestVideoDeleteBuilder(t *testing.T) { b.OwnerID(1) b.TargetID(1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["target_id"], 1) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["target_id"]) } func TestVideoDeleteAlbumBuilder(t *testing.T) { @@ -99,8 +99,8 @@ func TestVideoDeleteAlbumBuilder(t *testing.T) { b.GroupID(1) b.AlbumID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["album_id"]) } func TestVideoDeleteCommentBuilder(t *testing.T) { @@ -111,8 +111,8 @@ func TestVideoDeleteCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestVideoEditBuilder(t *testing.T) { @@ -129,14 +129,14 @@ func TestVideoEditBuilder(t *testing.T) { b.NoComments(true) b.Repeat(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["desc"], "text") - assert.Equal(t, b.Params["privacy_view"], []string{"text"}) - assert.Equal(t, b.Params["privacy_comment"], []string{"text"}) - assert.Equal(t, b.Params["no_comments"], true) - assert.Equal(t, b.Params["repeat"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["desc"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_view"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_comment"]) + assert.Equal(t, true, b.Params["no_comments"]) + assert.Equal(t, true, b.Params["repeat"]) } func TestVideoEditAlbumBuilder(t *testing.T) { @@ -149,10 +149,10 @@ func TestVideoEditAlbumBuilder(t *testing.T) { b.Title("text") b.Privacy([]string{"text"}) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["title"], "text") - assert.Equal(t, b.Params["privacy"], []string{"text"}) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, "text", b.Params["title"]) + assert.Equal(t, []string{"text"}, b.Params["privacy"]) } func TestVideoEditCommentBuilder(t *testing.T) { @@ -165,10 +165,10 @@ func TestVideoEditCommentBuilder(t *testing.T) { b.Message("text") b.Attachments([]string{"text"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) } func TestVideoGetBuilder(t *testing.T) { @@ -183,12 +183,12 @@ func TestVideoGetBuilder(t *testing.T) { b.Offset(1) b.Extended(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["videos"], []string{"text"}) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, []string{"text"}, b.Params["videos"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, true, b.Params["extended"]) } func TestVideoGetAlbumByIDBuilder(t *testing.T) { @@ -199,8 +199,8 @@ func TestVideoGetAlbumByIDBuilder(t *testing.T) { b.OwnerID(1) b.AlbumID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) } func TestVideoGetAlbumsBuilder(t *testing.T) { @@ -214,11 +214,11 @@ func TestVideoGetAlbumsBuilder(t *testing.T) { b.Extended(true) b.NeedSystem(true) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["need_system"], true) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["need_system"]) } func TestVideoGetAlbumsByVideoBuilder(t *testing.T) { @@ -231,10 +231,10 @@ func TestVideoGetAlbumsByVideoBuilder(t *testing.T) { b.VideoID(1) b.Extended(true) - assert.Equal(t, b.Params["target_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["extended"], true) + assert.Equal(t, 1, b.Params["target_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, true, b.Params["extended"]) } func TestVideoGetCommentsBuilder(t *testing.T) { @@ -252,15 +252,15 @@ func TestVideoGetCommentsBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"text"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["need_likes"], true) - assert.Equal(t, b.Params["start_comment_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["sort"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"text"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, true, b.Params["need_likes"]) + assert.Equal(t, 1, b.Params["start_comment_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["sort"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"text"}, b.Params["fields"]) } func TestVideoRemoveFromAlbumBuilder(t *testing.T) { @@ -274,11 +274,11 @@ func TestVideoRemoveFromAlbumBuilder(t *testing.T) { b.OwnerID(1) b.VideoID(1) - assert.Equal(t, b.Params["target_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["album_ids"], []int{1}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) + assert.Equal(t, 1, b.Params["target_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, []int{1}, b.Params["album_ids"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) } func TestVideoReorderAlbumsBuilder(t *testing.T) { @@ -291,10 +291,10 @@ func TestVideoReorderAlbumsBuilder(t *testing.T) { b.Before(1) b.After(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["before"], 1) - assert.Equal(t, b.Params["after"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["before"]) + assert.Equal(t, 1, b.Params["after"]) } func TestVideoReorderVideosBuilder(t *testing.T) { @@ -311,14 +311,14 @@ func TestVideoReorderVideosBuilder(t *testing.T) { b.AfterOwnerID(1) b.AfterVideoID(1) - assert.Equal(t, b.Params["target_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["before_owner_id"], 1) - assert.Equal(t, b.Params["before_video_id"], 1) - assert.Equal(t, b.Params["after_owner_id"], 1) - assert.Equal(t, b.Params["after_video_id"], 1) + assert.Equal(t, 1, b.Params["target_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, 1, b.Params["before_owner_id"]) + assert.Equal(t, 1, b.Params["before_video_id"]) + assert.Equal(t, 1, b.Params["after_owner_id"]) + assert.Equal(t, 1, b.Params["after_video_id"]) } func TestVideoReportBuilder(t *testing.T) { @@ -332,11 +332,11 @@ func TestVideoReportBuilder(t *testing.T) { b.Comment("text") b.SearchQuery("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["reason"], 1) - assert.Equal(t, b.Params["comment"], "text") - assert.Equal(t, b.Params["search_query"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, 1, b.Params["reason"]) + assert.Equal(t, "text", b.Params["comment"]) + assert.Equal(t, "text", b.Params["search_query"]) } func TestVideoReportCommentBuilder(t *testing.T) { @@ -348,9 +348,9 @@ func TestVideoReportCommentBuilder(t *testing.T) { b.CommentID(1) b.Reason(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["reason"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["reason"]) } func TestVideoRestoreBuilder(t *testing.T) { @@ -361,8 +361,8 @@ func TestVideoRestoreBuilder(t *testing.T) { b.VideoID(1) b.OwnerID(1) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) } func TestVideoRestoreCommentBuilder(t *testing.T) { @@ -373,8 +373,8 @@ func TestVideoRestoreCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestVideoSaveBuilder(t *testing.T) { @@ -396,19 +396,19 @@ func TestVideoSaveBuilder(t *testing.T) { b.Repeat(true) b.Compression(true) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["is_united_video_upload"], true) - assert.Equal(t, b.Params["is_private"], true) - assert.Equal(t, b.Params["wallpost"], true) - assert.Equal(t, b.Params["link"], "text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["album_id"], 1) - assert.Equal(t, b.Params["privacy_view"], []string{"text"}) - assert.Equal(t, b.Params["privacy_comment"], []string{"text"}) - assert.Equal(t, b.Params["no_comments"], true) - assert.Equal(t, b.Params["repeat"], true) - assert.Equal(t, b.Params["compression"], true) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, true, b.Params["is_united_video_upload"]) + assert.Equal(t, true, b.Params["is_private"]) + assert.Equal(t, true, b.Params["wallpost"]) + assert.Equal(t, "text", b.Params["link"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["album_id"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_view"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_comment"]) + assert.Equal(t, true, b.Params["no_comments"]) + assert.Equal(t, true, b.Params["repeat"]) + assert.Equal(t, true, b.Params["compression"]) } func TestVideoSearchBuilder(t *testing.T) { @@ -430,19 +430,19 @@ func TestVideoSearchBuilder(t *testing.T) { b.Legal(true) b.LegalOwner(1) - assert.Equal(t, b.Params["q"], "text") - assert.Equal(t, b.Params["sort"], 1) - assert.Equal(t, b.Params["hd"], 1) - assert.Equal(t, b.Params["adult"], true) - assert.Equal(t, b.Params["filters"], []string{"text"}) - assert.Equal(t, b.Params["search_own"], true) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["longer"], 1) - assert.Equal(t, b.Params["shorter"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["legal"], true) - assert.Equal(t, b.Params["legal_owner"], 1) + assert.Equal(t, "text", b.Params["q"]) + assert.Equal(t, 1, b.Params["sort"]) + assert.Equal(t, 1, b.Params["hd"]) + assert.Equal(t, true, b.Params["adult"]) + assert.Equal(t, []string{"text"}, b.Params["filters"]) + assert.Equal(t, true, b.Params["search_own"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["longer"]) + assert.Equal(t, 1, b.Params["shorter"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, true, b.Params["legal"]) + assert.Equal(t, 1, b.Params["legal_owner"]) } func TestVideoStartStreamingBuilder(t *testing.T) { @@ -461,16 +461,16 @@ func TestVideoStartStreamingBuilder(t *testing.T) { b.CategoryID(1) b.Publish(true) - assert.Equal(t, b.Params["video_id"], 1) - assert.Equal(t, b.Params["name"], "text") - assert.Equal(t, b.Params["description"], "text") - assert.Equal(t, b.Params["wallpost"], true) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["privacy_view"], []string{"text"}) - assert.Equal(t, b.Params["privacy_comment"], []string{"text"}) - assert.Equal(t, b.Params["no_comments"], true) - assert.Equal(t, b.Params["category_id"], 1) - assert.Equal(t, b.Params["publish"], true) + assert.Equal(t, 1, b.Params["video_id"]) + assert.Equal(t, "text", b.Params["name"]) + assert.Equal(t, "text", b.Params["description"]) + assert.Equal(t, true, b.Params["wallpost"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_view"]) + assert.Equal(t, []string{"text"}, b.Params["privacy_comment"]) + assert.Equal(t, true, b.Params["no_comments"]) + assert.Equal(t, 1, b.Params["category_id"]) + assert.Equal(t, true, b.Params["publish"]) } func TestVideoStopStreamingBuilder(t *testing.T) { @@ -482,7 +482,7 @@ func TestVideoStopStreamingBuilder(t *testing.T) { b.OwnerID(1) b.VideoID(1) - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["video_id"], 1) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["video_id"]) } diff --git a/api/params/wall_test.go b/api/params/wall_test.go index 7f54b04e..c5820841 100644 --- a/api/params/wall_test.go +++ b/api/params/wall_test.go @@ -14,7 +14,7 @@ func TestWallCheckCopyrightLinkBuilder(t *testing.T) { b.Link("test") - assert.Equal(t, b.Params["link"], "test") + assert.Equal(t, "test", b.Params["link"]) } func TestWallCloseCommentsBuilder(t *testing.T) { @@ -25,8 +25,8 @@ func TestWallCloseCommentsBuilder(t *testing.T) { b.OwnerID(1) b.PostID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) } func TestWallCreateCommentBuilder(t *testing.T) { @@ -43,14 +43,14 @@ func TestWallCreateCommentBuilder(t *testing.T) { b.StickerID(1) b.GUID("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) - assert.Equal(t, b.Params["from_group"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["reply_to_comment"], 1) - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["sticker_id"], 1) - assert.Equal(t, b.Params["guid"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) + assert.Equal(t, 1, b.Params["from_group"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, 1, b.Params["reply_to_comment"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, 1, b.Params["sticker_id"]) + assert.Equal(t, "text", b.Params["guid"]) } func TestWallDeleteBuilder(t *testing.T) { @@ -61,8 +61,8 @@ func TestWallDeleteBuilder(t *testing.T) { b.OwnerID(1) b.PostID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) } func TestWallDeleteCommentBuilder(t *testing.T) { @@ -73,8 +73,8 @@ func TestWallDeleteCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestWallEditBuilder(t *testing.T) { @@ -99,22 +99,22 @@ func TestWallEditBuilder(t *testing.T) { b.PosterBkgOwnerID(1) b.PosterBkgAccessHash("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) - assert.Equal(t, b.Params["friends_only"], true) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["services"], "text") - assert.Equal(t, b.Params["signed"], true) - assert.Equal(t, b.Params["publish_date"], 1) - assert.Equal(t, b.Params["lat"], 1.1) - assert.Equal(t, b.Params["long"], 1.1) - assert.Equal(t, b.Params["place_id"], 1) - assert.Equal(t, b.Params["mark_as_ads"], true) - assert.Equal(t, b.Params["close_comments"], true) - assert.Equal(t, b.Params["poster_bkg_id"], 1) - assert.Equal(t, b.Params["poster_bkg_owner_id"], 1) - assert.Equal(t, b.Params["poster_bkg_access_hash"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) + assert.Equal(t, true, b.Params["friends_only"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, "text", b.Params["services"]) + assert.Equal(t, true, b.Params["signed"]) + assert.Equal(t, 1, b.Params["publish_date"]) + assert.InEpsilon(t, 1.1, b.Params["lat"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["long"], 0.1) + assert.Equal(t, 1, b.Params["place_id"]) + assert.Equal(t, true, b.Params["mark_as_ads"]) + assert.Equal(t, true, b.Params["close_comments"]) + assert.Equal(t, 1, b.Params["poster_bkg_id"]) + assert.Equal(t, 1, b.Params["poster_bkg_owner_id"]) + assert.Equal(t, "text", b.Params["poster_bkg_access_hash"]) } func TestWallEditAdsStealthBuilder(t *testing.T) { @@ -135,18 +135,18 @@ func TestWallEditAdsStealthBuilder(t *testing.T) { b.LinkImage("text") b.LinkVideo("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["signed"], true) - assert.Equal(t, b.Params["lat"], 1.1) - assert.Equal(t, b.Params["long"], 1.1) - assert.Equal(t, b.Params["place_id"], 1) - assert.Equal(t, b.Params["link_button"], "text") - assert.Equal(t, b.Params["link_title"], "text") - assert.Equal(t, b.Params["link_image"], "text") - assert.Equal(t, b.Params["link_video"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, true, b.Params["signed"]) + assert.InEpsilon(t, 1.1, b.Params["lat"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["long"], 0.1) + assert.Equal(t, 1, b.Params["place_id"]) + assert.Equal(t, "text", b.Params["link_button"]) + assert.Equal(t, "text", b.Params["link_title"]) + assert.Equal(t, "text", b.Params["link_image"]) + assert.Equal(t, "text", b.Params["link_video"]) } func TestWallEditCommentBuilder(t *testing.T) { @@ -159,10 +159,10 @@ func TestWallEditCommentBuilder(t *testing.T) { b.Message("text") b.Attachments([]string{"text"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) } func TestWallGetBuilder(t *testing.T) { @@ -178,13 +178,13 @@ func TestWallGetBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["domain"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["filter"], "text") - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["domain"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["filter"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestWallGetByIDBuilder(t *testing.T) { @@ -197,10 +197,10 @@ func TestWallGetByIDBuilder(t *testing.T) { b.CopyHistoryDepth(1) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["posts"], []string{"text"}) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["copy_history_depth"], 1) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, []string{"text"}, b.Params["posts"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, 1, b.Params["copy_history_depth"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestWallGetCommentsBuilder(t *testing.T) { @@ -221,18 +221,18 @@ func TestWallGetCommentsBuilder(t *testing.T) { b.CommentID(1) b.ThreadItemsCount(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) - assert.Equal(t, b.Params["need_likes"], true) - assert.Equal(t, b.Params["start_comment_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["sort"], "text") - assert.Equal(t, b.Params["preview_length"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["thread_items_count"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) + assert.Equal(t, true, b.Params["need_likes"]) + assert.Equal(t, 1, b.Params["start_comment_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, "text", b.Params["sort"]) + assert.Equal(t, 1, b.Params["preview_length"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["thread_items_count"]) } func TestWallGetRepostsBuilder(t *testing.T) { @@ -245,10 +245,10 @@ func TestWallGetRepostsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestWallOpenCommentsBuilder(t *testing.T) { @@ -259,8 +259,8 @@ func TestWallOpenCommentsBuilder(t *testing.T) { b.OwnerID(1) b.PostID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) } func TestWallPinBuilder(t *testing.T) { @@ -271,8 +271,8 @@ func TestWallPinBuilder(t *testing.T) { b.OwnerID(1) b.PostID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) } func TestWallPostBuilder(t *testing.T) { @@ -300,25 +300,25 @@ func TestWallPostBuilder(t *testing.T) { b.Copyright("test") b.TopicID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["friends_only"], true) - assert.Equal(t, b.Params["from_group"], true) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["services"], "text") - assert.Equal(t, b.Params["signed"], true) - assert.Equal(t, b.Params["publish_date"], 1) - assert.Equal(t, b.Params["lat"], 1.1) - assert.Equal(t, b.Params["long"], 1.1) - assert.Equal(t, b.Params["place_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) - assert.Equal(t, b.Params["guid"], "text") - assert.Equal(t, b.Params["mark_as_ads"], true) - assert.Equal(t, b.Params["close_comments"], true) - assert.Equal(t, b.Params["donut_paid_duration"], 1) - assert.Equal(t, b.Params["mute_notifications"], true) - assert.Equal(t, b.Params["copyright"], "test") - assert.Equal(t, b.Params["topic_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, true, b.Params["friends_only"]) + assert.Equal(t, true, b.Params["from_group"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, "text", b.Params["services"]) + assert.Equal(t, true, b.Params["signed"]) + assert.Equal(t, 1, b.Params["publish_date"]) + assert.InEpsilon(t, 1.1, b.Params["lat"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["long"], 0.1) + assert.Equal(t, 1, b.Params["place_id"]) + assert.Equal(t, 1, b.Params["post_id"]) + assert.Equal(t, "text", b.Params["guid"]) + assert.Equal(t, true, b.Params["mark_as_ads"]) + assert.Equal(t, true, b.Params["close_comments"]) + assert.Equal(t, 1, b.Params["donut_paid_duration"]) + assert.Equal(t, true, b.Params["mute_notifications"]) + assert.Equal(t, "test", b.Params["copyright"]) + assert.Equal(t, 1, b.Params["topic_id"]) } func TestWallPostAdsStealthBuilder(t *testing.T) { @@ -339,18 +339,18 @@ func TestWallPostAdsStealthBuilder(t *testing.T) { b.LinkImage("text") b.LinkVideo("text") - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["attachments"], []string{"text"}) - assert.Equal(t, b.Params["signed"], true) - assert.Equal(t, b.Params["lat"], 1.1) - assert.Equal(t, b.Params["long"], 1.1) - assert.Equal(t, b.Params["place_id"], 1) - assert.Equal(t, b.Params["guid"], "text") - assert.Equal(t, b.Params["link_button"], "text") - assert.Equal(t, b.Params["link_title"], "text") - assert.Equal(t, b.Params["link_image"], "text") - assert.Equal(t, b.Params["link_video"], "text") + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, []string{"text"}, b.Params["attachments"]) + assert.Equal(t, true, b.Params["signed"]) + assert.InEpsilon(t, 1.1, b.Params["lat"], 0.1) + assert.InEpsilon(t, 1.1, b.Params["long"], 0.1) + assert.Equal(t, 1, b.Params["place_id"]) + assert.Equal(t, "text", b.Params["guid"]) + assert.Equal(t, "text", b.Params["link_button"]) + assert.Equal(t, "text", b.Params["link_title"]) + assert.Equal(t, "text", b.Params["link_image"]) + assert.Equal(t, "text", b.Params["link_video"]) } func TestWallReportCommentBuilder(t *testing.T) { @@ -362,9 +362,9 @@ func TestWallReportCommentBuilder(t *testing.T) { b.CommentID(1) b.Reason(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) - assert.Equal(t, b.Params["reason"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) + assert.Equal(t, 1, b.Params["reason"]) } func TestWallReportPostBuilder(t *testing.T) { @@ -376,9 +376,9 @@ func TestWallReportPostBuilder(t *testing.T) { b.PostID(1) b.Reason(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) - assert.Equal(t, b.Params["reason"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) + assert.Equal(t, 1, b.Params["reason"]) } func TestWallRepostBuilder(t *testing.T) { @@ -392,11 +392,11 @@ func TestWallRepostBuilder(t *testing.T) { b.MarkAsAds(true) b.MuteNotifications(true) - assert.Equal(t, b.Params["object"], "text") - assert.Equal(t, b.Params["message"], "text") - assert.Equal(t, b.Params["group_id"], 1) - assert.Equal(t, b.Params["mark_as_ads"], true) - assert.Equal(t, b.Params["mute_notifications"], true) + assert.Equal(t, "text", b.Params["object"]) + assert.Equal(t, "text", b.Params["message"]) + assert.Equal(t, 1, b.Params["group_id"]) + assert.Equal(t, true, b.Params["mark_as_ads"]) + assert.Equal(t, true, b.Params["mute_notifications"]) } func TestWallRestoreBuilder(t *testing.T) { @@ -407,8 +407,8 @@ func TestWallRestoreBuilder(t *testing.T) { b.OwnerID(1) b.PostID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) } func TestWallRestoreCommentBuilder(t *testing.T) { @@ -419,8 +419,8 @@ func TestWallRestoreCommentBuilder(t *testing.T) { b.OwnerID(1) b.CommentID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["comment_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["comment_id"]) } func TestWallSearchBuilder(t *testing.T) { @@ -437,14 +437,14 @@ func TestWallSearchBuilder(t *testing.T) { b.Extended(true) b.Fields([]string{"test"}) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["domain"], "text") - assert.Equal(t, b.Params["query"], "text") - assert.Equal(t, b.Params["owners_only"], true) - assert.Equal(t, b.Params["count"], 1) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["extended"], true) - assert.Equal(t, b.Params["fields"], []string{"test"}) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, "text", b.Params["domain"]) + assert.Equal(t, "text", b.Params["query"]) + assert.Equal(t, true, b.Params["owners_only"]) + assert.Equal(t, 1, b.Params["count"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, true, b.Params["extended"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) } func TestWallUnpinBuilder(t *testing.T) { @@ -455,6 +455,6 @@ func TestWallUnpinBuilder(t *testing.T) { b.OwnerID(1) b.PostID(1) - assert.Equal(t, b.Params["owner_id"], 1) - assert.Equal(t, b.Params["post_id"], 1) + assert.Equal(t, 1, b.Params["owner_id"]) + assert.Equal(t, 1, b.Params["post_id"]) } diff --git a/api/params/widgets_test.go b/api/params/widgets_test.go index 2a984f89..29e52c8a 100644 --- a/api/params/widgets_test.go +++ b/api/params/widgets_test.go @@ -20,13 +20,13 @@ func TestWidgetsGetCommentsBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["widget_api_id"], 1) - assert.Equal(t, b.Params["url"], "text") - assert.Equal(t, b.Params["page_id"], "text") - assert.Equal(t, b.Params["order"], "text") - assert.Equal(t, b.Params["fields"], []string{"test"}) - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["widget_api_id"]) + assert.Equal(t, "text", b.Params["url"]) + assert.Equal(t, "text", b.Params["page_id"]) + assert.Equal(t, "text", b.Params["order"]) + assert.Equal(t, []string{"test"}, b.Params["fields"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } func TestWidgetsGetPagesBuilder(t *testing.T) { @@ -40,9 +40,9 @@ func TestWidgetsGetPagesBuilder(t *testing.T) { b.Offset(1) b.Count(1) - assert.Equal(t, b.Params["widget_api_id"], 1) - assert.Equal(t, b.Params["order"], "text") - assert.Equal(t, b.Params["period"], "text") - assert.Equal(t, b.Params["offset"], 1) - assert.Equal(t, b.Params["count"], 1) + assert.Equal(t, 1, b.Params["widget_api_id"]) + assert.Equal(t, "text", b.Params["order"]) + assert.Equal(t, "text", b.Params["period"]) + assert.Equal(t, 1, b.Params["offset"]) + assert.Equal(t, 1, b.Params["count"]) } diff --git a/api/storage_test.go b/api/storage_test.go index 31318e04..059ea93e 100644 --- a/api/storage_test.go +++ b/api/storage_test.go @@ -48,7 +48,7 @@ func TestStorageGetResponse_ToMap(t *testing.T) { f := func(s api.StorageGetResponse, wantMap map[string]string) { t.Helper() - assert.Equal(t, s.ToMap(), wantMap) + assert.Equal(t, wantMap, s.ToMap()) } f( diff --git a/api/upload.go b/api/upload.go index 70362ebe..b8f08b01 100644 --- a/api/upload.go +++ b/api/upload.go @@ -180,7 +180,7 @@ func (vk *VK) uploadOwnerPhoto(params Params, squareCrop string, file io.Reader) ) { uploadServer, err := vk.PhotosGetOwnerPhotoUploadServer(params) if err != nil { - return + return response, err } body := new(bytes.Buffer) @@ -188,12 +188,12 @@ func (vk *VK) uploadOwnerPhoto(params Params, squareCrop string, file io.Reader) part, err := writer.CreateFormFile("photo", "photo.jpeg") if err != nil { - return + return response, err } _, err = io.Copy(part, file) if err != nil { - return + return response, err } contentType := writer.FormDataContentType() @@ -201,7 +201,7 @@ func (vk *VK) uploadOwnerPhoto(params Params, squareCrop string, file io.Reader) if squareCrop != "" { err = writer.WriteField("_square_crop", squareCrop) if err != nil { - return + return response, err } } @@ -209,20 +209,20 @@ func (vk *VK) uploadOwnerPhoto(params Params, squareCrop string, file io.Reader) resp, err := vk.Client.Post(uploadServer.UploadURL, contentType, body) if err != nil { - return + return response, err } defer resp.Body.Close() bodyContent, err := io.ReadAll(resp.Body) if err != nil { - return + return response, err } var handler object.PhotosOwnerUploadResponse err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } response, err = vk.PhotosSaveOwnerPhoto(Params{ @@ -523,26 +523,26 @@ func (vk *VK) UploadVideo(params Params, file io.Reader) (response VideoSaveResp func (vk *VK) uploadDoc(url, title, tags string, file io.Reader) (response DocsSaveResponse, err error) { bodyContent, err := vk.UploadFile(url, file, "file", title) if err != nil { - return + return response, err } var docUploadError UploadError err = json.Unmarshal(bodyContent, &docUploadError) if err != nil { - return + return response, err } if docUploadError.Err != "" { err = &docUploadError - return + return response, err } var handler object.DocsDocUploadResponse err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } response, err = vk.DocsSave(Params{ @@ -562,12 +562,12 @@ func (vk *VK) uploadDoc(url, title, tags string, file io.Reader) (response DocsS func (vk *VK) UploadDoc(title, tags string, file io.Reader) (response DocsSaveResponse, err error) { uploadServer, err := vk.DocsGetUploadServer(nil) if err != nil { - return + return response, err } response, err = vk.uploadDoc(uploadServer.UploadURL, title, tags, file) - return + return response, err } // UploadGroupDoc uploading Documents into Community. @@ -580,12 +580,12 @@ func (vk *VK) UploadGroupDoc(groupID int, title, tags string, file io.Reader) (r "group_id": groupID, }) if err != nil { - return + return response, err } response, err = vk.uploadDoc(uploadServer.UploadURL, title, tags, file) - return + return response, err } // UploadWallDoc uploading Documents on Wall. @@ -596,12 +596,12 @@ func (vk *VK) UploadGroupDoc(groupID int, title, tags string, file io.Reader) (r func (vk *VK) UploadWallDoc(title, tags string, file io.Reader) (response DocsSaveResponse, err error) { uploadServer, err := vk.DocsGetWallUploadServer(nil) if err != nil { - return + return response, err } response, err = vk.uploadDoc(uploadServer.UploadURL, title, tags, file) - return + return response, err } // UploadGroupWallDoc uploading Documents on Group Wall. @@ -617,12 +617,12 @@ func (vk *VK) UploadGroupWallDoc(groupID int, title, tags string, file io.Reader "group_id": groupID, }) if err != nil { - return + return response, err } response, err = vk.uploadDoc(uploadServer.UploadURL, title, tags, file) - return + return response, err } // UploadMessagesDoc uploading Documents into a Private Message. @@ -639,12 +639,12 @@ func (vk *VK) UploadMessagesDoc(peerID int, typeDoc, title, tags string, file io "type": typeDoc, }) if err != nil { - return + return response, err } response, err = vk.uploadDoc(uploadServer.UploadURL, title, tags, file) - return + return response, err } // UploadOwnerCoverPhoto uploading a Main Photo to a Group Chat. @@ -665,19 +665,19 @@ func (vk *VK) UploadOwnerCoverPhoto(groupID, cropX, cropY, cropX2, cropY2 int, f "crop_y2": cropY2, }) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.UploadURL, file, "photo", "photo.jpeg") if err != nil { - return + return response, err } var handler object.PhotosOwnerUploadResponse err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } return vk.PhotosSaveOwnerCoverPhoto(Params{ @@ -716,19 +716,19 @@ type rawUploadStoriesVideo struct { func (vk *VK) UploadStoriesPhoto(params Params, file io.Reader) (response StoriesSaveResponse, err error) { uploadServer, err := vk.StoriesGetPhotoUploadServer(params) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.UploadURL, file, "file", "file.jpeg") if err != nil { - return + return response, err } var handler rawUploadStoriesPhoto err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } if handler.Error.ErrorCode != 0 { @@ -753,19 +753,19 @@ func (vk *VK) UploadStoriesPhoto(params Params, file io.Reader) (response Storie func (vk *VK) UploadStoriesVideo(params Params, file io.Reader) (response StoriesSaveResponse, err error) { uploadServer, err := vk.StoriesGetVideoUploadServer(params) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.UploadURL, file, "video_file", "video.mp4") if err != nil { - return + return response, err } var handler rawUploadStoriesVideo err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } if handler.UploadError.Code != 0 { @@ -788,19 +788,19 @@ func (vk *VK) UploadStoriesVideo(params Params, file io.Reader) (response Storie func (vk *VK) uploadPollsPhoto(params Params, file io.Reader) (response PollsSavePhotoResponse, err error) { uploadServer, err := vk.PollsGetPhotoUploadServer(params) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.UploadURL, file, "photo", "photo.jpeg") if err != nil { - return + return response, err } var handler object.PollsPhotoUploadResponse err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } response, err = vk.PollsSavePhoto(Params{ @@ -808,7 +808,7 @@ func (vk *VK) uploadPollsPhoto(params Params, file io.Reader) (response PollsSav "hash": handler.Hash, }) - return + return response, err } // UploadPollsPhoto uploading a Poll Photo. @@ -842,19 +842,19 @@ type uploadPrettyCardsPhotoHandler struct { func (vk *VK) UploadPrettyCardsPhoto(file io.Reader) (response string, err error) { uploadURL, err := vk.PrettyCardsGetUploadURL(nil) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadURL, file, "file", "photo.jpg") if err != nil { - return + return response, err } var handler uploadPrettyCardsPhotoHandler err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } response = handler.Photo @@ -863,7 +863,7 @@ func (vk *VK) UploadPrettyCardsPhoto(file io.Reader) (response string, err error err = &UploadError{Code: handler.ErrCode} } - return + return response, err } type uploadLeadFormsPhotoHandler struct { @@ -877,19 +877,19 @@ type uploadLeadFormsPhotoHandler struct { func (vk *VK) UploadLeadFormsPhoto(file io.Reader) (response string, err error) { uploadURL, err := vk.LeadFormsGetUploadURL(nil) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadURL, file, "file", "photo.jpg") if err != nil { - return + return response, err } var handler uploadLeadFormsPhotoHandler err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } response = handler.Photo @@ -898,7 +898,7 @@ func (vk *VK) UploadLeadFormsPhoto(file io.Reader) (response string, err error) err = &UploadError{Code: handler.ErrCode} } - return + return response, err } // UploadAppImage uploading a Image into App collection for community app widgets. @@ -907,19 +907,19 @@ func (vk *VK) UploadAppImage(imageType string, file io.Reader) (response object. "image_type": imageType, }) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.UploadURL, file, "image", "photo.jpeg") if err != nil { - return + return response, err } var handler object.AppWidgetsAppImageUploadResponse err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } response, err = vk.AppWidgetsSaveAppImage(Params{ @@ -927,7 +927,7 @@ func (vk *VK) UploadAppImage(imageType string, file io.Reader) (response object. "hash": handler.Hash, }) - return + return response, err } // UploadGroupImage uploading a Image into Community collection for community app widgets. @@ -936,19 +936,19 @@ func (vk *VK) UploadGroupImage(imageType string, file io.Reader) (response objec "image_type": imageType, }) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.UploadURL, file, "image", "photo.jpeg") if err != nil { - return + return response, err } var handler object.AppWidgetsGroupImageUploadResponse err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } response, err = vk.AppWidgetsSaveGroupImage(Params{ @@ -956,7 +956,7 @@ func (vk *VK) UploadGroupImage(imageType string, file io.Reader) (response objec "hash": handler.Hash, }) - return + return response, err } // UploadMarusiaPicture uploading picture. @@ -966,19 +966,19 @@ func (vk *VK) UploadGroupImage(imageType string, file io.Reader) (response objec func (vk *VK) UploadMarusiaPicture(file io.Reader) (response MarusiaSavePictureResponse, err error) { uploadServer, err := vk.MarusiaGetPictureUploadLink(nil) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.PictureUploadLink, file, "photo", "photo.jpg") if err != nil { - return + return response, err } var handler object.MarusiaPictureUploadResponse err = json.Unmarshal(bodyContent, &handler) if err != nil { - return + return response, err } photo, _ := json.Marshal(handler.Photo) @@ -989,7 +989,7 @@ func (vk *VK) UploadMarusiaPicture(file io.Reader) (response MarusiaSavePictureR "hash": handler.Hash, }) - return + return response, err } // UploadMarusiaAudio uploading audio. @@ -998,17 +998,17 @@ func (vk *VK) UploadMarusiaPicture(file io.Reader) (response MarusiaSavePictureR func (vk *VK) UploadMarusiaAudio(file io.Reader) (response MarusiaCreateAudioResponse, err error) { uploadServer, err := vk.MarusiaGetAudioUploadLink(nil) if err != nil { - return + return response, err } bodyContent, err := vk.UploadFile(uploadServer.AudioUploadLink, file, "file", "audio.mp3") if err != nil { - return + return response, err } response, err = vk.MarusiaCreateAudio(Params{ "audio_meta": string(bodyContent), }) - return + return response, err } diff --git a/api/wall_test.go b/api/wall_test.go index 0b713598..550ab45a 100644 --- a/api/wall_test.go +++ b/api/wall_test.go @@ -1,7 +1,6 @@ package api_test import ( - "errors" "testing" "github.com/SevereCloud/vksdk/v2/api" @@ -23,7 +22,7 @@ func TestVK_WallCheckCopyrightLink(t *testing.T) { _, err = vkUser.WallCheckCopyrightLink(api.Params{ "link": "https://vk.com/severecloud", }) - assert.True(t, errors.Is(err, api.ErrWallCheckLinkCantDetermineSource)) + assert.ErrorIs(t, err, api.ErrWallCheckLinkCantDetermineSource) } func TestVK_WallPost(t *testing.T) { diff --git a/callback/context_test.go b/callback/context_test.go index 1eb9409f..f6e41c21 100644 --- a/callback/context_test.go +++ b/callback/context_test.go @@ -33,7 +33,7 @@ func TestRetryAfter(t *testing.T) { date := time.Now().Add(time.Minute * 5) cb := callback.NewCallback() - cb.MessageNew(func(ctx context.Context, obj events.MessageNewObject) { + cb.MessageNew(func(ctx context.Context, _ events.MessageNewObject) { callback.RetryAfter( ctx, code, @@ -62,7 +62,7 @@ func TestRemove(t *testing.T) { t.Parallel() cb := callback.NewCallback() - cb.MessageNew(func(ctx context.Context, obj events.MessageNewObject) { + cb.MessageNew(func(ctx context.Context, _ events.MessageNewObject) { callback.Remove(ctx) }) diff --git a/callback/setting.go b/callback/setting.go index 6f66331f..816c0603 100644 --- a/callback/setting.go +++ b/callback/setting.go @@ -82,13 +82,13 @@ func (cb *Callback) AutoSetting( cb.SecretKeys[groupID] = cbServer.SecretKey break - } else { - // Broken Callback server - _, _ = vk.GroupsDeleteCallbackServer(api.Params{ - "group_id": groupID, - "server_id": cbServer.ID, - }) } + + // Broken Callback server + _, _ = vk.GroupsDeleteCallbackServer(api.Params{ + "group_id": groupID, + "server_id": cbServer.ID, + }) } } diff --git a/callback/setting_test.go b/callback/setting_test.go index cd598612..dfdde43e 100644 --- a/callback/setting_test.go +++ b/callback/setting_test.go @@ -2,7 +2,6 @@ package callback_test import ( "context" - "errors" "os" "testing" @@ -18,9 +17,9 @@ func TestAutoSetting_ErrAuth(t *testing.T) { vk := api.NewVK("") cb := callback.NewCallback() - cb.MessageNew(func(_ context.Context, obj events.MessageNewObject) {}) + cb.MessageNew(func(_ context.Context, _ events.MessageNewObject) {}) err := cb.AutoSetting(vk, "https://example.com") - assert.Equal(t, true, errors.Is(err, api.ErrAuth), err) + assert.ErrorIs(t, err, api.ErrAuth) } func TestAutoSetting_ErrNeedGroupToken(t *testing.T) { @@ -34,9 +33,9 @@ func TestAutoSetting_ErrNeedGroupToken(t *testing.T) { vk := api.NewVK(userToken) cb := callback.NewCallback() - cb.MessageNew(func(_ context.Context, obj events.MessageNewObject) {}) + cb.MessageNew(func(_ context.Context, _ events.MessageNewObject) {}) err := cb.AutoSetting(vk, "https://example.com") - assert.Equal(t, true, errors.Is(err, callback.ErrNeedGroupToken), err) + assert.ErrorIs(t, err, callback.ErrNeedGroupToken) } func TestAutoSetting_Err(t *testing.T) { @@ -50,7 +49,7 @@ func TestAutoSetting_Err(t *testing.T) { vk := api.NewVK(groupToken) cb := callback.NewCallback() - cb.MessageNew(func(_ context.Context, obj events.MessageNewObject) {}) + cb.MessageNew(func(_ context.Context, _ events.MessageNewObject) {}) err := cb.AutoSetting(vk, "https://example.com") assert.NoError(t, err) } diff --git a/events/events_test.go b/events/events_test.go index 70aa465b..8991b9b6 100644 --- a/events/events_test.go +++ b/events/events_test.go @@ -20,7 +20,7 @@ func TestFuncList_HandlerMessageNew(t *testing.T) { t.Helper() groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) assert.NotEmpty(t, obj.Message) }) @@ -63,9 +63,9 @@ func TestFuncList_HandlerMessageReply(t *testing.T) { fl := events.NewFuncList() - fl.MessageReply(func(ctx context.Context, obj events.MessageReplyObject) { + fl.MessageReply(func(ctx context.Context, _ events.MessageReplyObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMessageReply}, fl.ListEvents()) @@ -106,9 +106,9 @@ func TestFuncList_HandlerMessageEdit(t *testing.T) { fl := events.NewFuncList() - fl.MessageEdit(func(ctx context.Context, obj events.MessageEditObject) { + fl.MessageEdit(func(ctx context.Context, _ events.MessageEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMessageEdit}, fl.ListEvents()) @@ -149,9 +149,9 @@ func TestFuncList_HandlerMessageAllow(t *testing.T) { fl := events.NewFuncList() - fl.MessageAllow(func(ctx context.Context, obj events.MessageAllowObject) { + fl.MessageAllow(func(ctx context.Context, _ events.MessageAllowObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMessageAllow}, fl.ListEvents()) @@ -192,9 +192,9 @@ func TestFuncList_HandlerMessageDeny(t *testing.T) { fl := events.NewFuncList() - fl.MessageDeny(func(ctx context.Context, obj events.MessageDenyObject) { + fl.MessageDeny(func(ctx context.Context, _ events.MessageDenyObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMessageDeny}, fl.ListEvents()) @@ -235,9 +235,9 @@ func TestFuncList_HandlerMessageTypingState(t *testing.T) { fl := events.NewFuncList() - fl.MessageTypingState(func(ctx context.Context, obj events.MessageTypingStateObject) { + fl.MessageTypingState(func(ctx context.Context, _ events.MessageTypingStateObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMessageTypingState}, fl.ListEvents()) @@ -278,9 +278,9 @@ func TestFuncList_HandlerMessageEvent(t *testing.T) { fl := events.NewFuncList() - fl.MessageEvent(func(ctx context.Context, obj events.MessageEventObject) { + fl.MessageEvent(func(ctx context.Context, _ events.MessageEventObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMessageEvent}, fl.ListEvents()) @@ -321,9 +321,9 @@ func TestFuncList_HandlerPhotoNew(t *testing.T) { fl := events.NewFuncList() - fl.PhotoNew(func(ctx context.Context, obj events.PhotoNewObject) { + fl.PhotoNew(func(ctx context.Context, _ events.PhotoNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventPhotoNew}, fl.ListEvents()) @@ -364,9 +364,9 @@ func TestFuncList_HandlerPhotoCommentNew(t *testing.T) { fl := events.NewFuncList() - fl.PhotoCommentNew(func(ctx context.Context, obj events.PhotoCommentNewObject) { + fl.PhotoCommentNew(func(ctx context.Context, _ events.PhotoCommentNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventPhotoCommentNew}, fl.ListEvents()) @@ -407,9 +407,9 @@ func TestFuncList_HandlerPhotoCommentEdit(t *testing.T) { fl := events.NewFuncList() - fl.PhotoCommentEdit(func(ctx context.Context, obj events.PhotoCommentEditObject) { + fl.PhotoCommentEdit(func(ctx context.Context, _ events.PhotoCommentEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventPhotoCommentEdit}, fl.ListEvents()) @@ -450,9 +450,9 @@ func TestFuncList_HandlerPhotoCommentRestore(t *testing.T) { fl := events.NewFuncList() - fl.PhotoCommentRestore(func(ctx context.Context, obj events.PhotoCommentRestoreObject) { + fl.PhotoCommentRestore(func(ctx context.Context, _ events.PhotoCommentRestoreObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventPhotoCommentRestore}, fl.ListEvents()) @@ -493,9 +493,9 @@ func TestFuncList_HandlerPhotoCommentDelete(t *testing.T) { fl := events.NewFuncList() - fl.PhotoCommentDelete(func(ctx context.Context, obj events.PhotoCommentDeleteObject) { + fl.PhotoCommentDelete(func(ctx context.Context, _ events.PhotoCommentDeleteObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventPhotoCommentDelete}, fl.ListEvents()) @@ -536,9 +536,9 @@ func TestFuncList_HandlerAudioNew(t *testing.T) { fl := events.NewFuncList() - fl.AudioNew(func(ctx context.Context, obj events.AudioNewObject) { + fl.AudioNew(func(ctx context.Context, _ events.AudioNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventAudioNew}, fl.ListEvents()) @@ -579,9 +579,9 @@ func TestFuncList_HandlerVideoNew(t *testing.T) { fl := events.NewFuncList() - fl.VideoNew(func(ctx context.Context, obj events.VideoNewObject) { + fl.VideoNew(func(ctx context.Context, _ events.VideoNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventVideoNew}, fl.ListEvents()) @@ -622,9 +622,9 @@ func TestFuncList_HandlerVideoCommentNew(t *testing.T) { fl := events.NewFuncList() - fl.VideoCommentNew(func(ctx context.Context, obj events.VideoCommentNewObject) { + fl.VideoCommentNew(func(ctx context.Context, _ events.VideoCommentNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventVideoCommentNew}, fl.ListEvents()) @@ -665,9 +665,9 @@ func TestFuncList_HandlerVideoCommentEdit(t *testing.T) { fl := events.NewFuncList() - fl.VideoCommentEdit(func(ctx context.Context, obj events.VideoCommentEditObject) { + fl.VideoCommentEdit(func(ctx context.Context, _ events.VideoCommentEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventVideoCommentEdit}, fl.ListEvents()) @@ -708,9 +708,9 @@ func TestFuncList_HandlerVideoCommentRestore(t *testing.T) { fl := events.NewFuncList() - fl.VideoCommentRestore(func(ctx context.Context, obj events.VideoCommentRestoreObject) { + fl.VideoCommentRestore(func(ctx context.Context, _ events.VideoCommentRestoreObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventVideoCommentRestore}, fl.ListEvents()) @@ -751,9 +751,9 @@ func TestFuncList_HandlerVideoCommentDelete(t *testing.T) { fl := events.NewFuncList() - fl.VideoCommentDelete(func(ctx context.Context, obj events.VideoCommentDeleteObject) { + fl.VideoCommentDelete(func(ctx context.Context, _ events.VideoCommentDeleteObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventVideoCommentDelete}, fl.ListEvents()) @@ -794,9 +794,9 @@ func TestFuncList_HandlerWallPostNew(t *testing.T) { fl := events.NewFuncList() - fl.WallPostNew(func(ctx context.Context, obj events.WallPostNewObject) { + fl.WallPostNew(func(ctx context.Context, _ events.WallPostNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventWallPostNew}, fl.ListEvents()) @@ -837,9 +837,9 @@ func TestFuncList_HandlerWallRepost(t *testing.T) { fl := events.NewFuncList() - fl.WallRepost(func(ctx context.Context, obj events.WallRepostObject) { + fl.WallRepost(func(ctx context.Context, _ events.WallRepostObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventWallRepost}, fl.ListEvents()) @@ -880,9 +880,9 @@ func TestFuncList_HandlerWallReplyNew(t *testing.T) { fl := events.NewFuncList() - fl.WallReplyNew(func(ctx context.Context, obj events.WallReplyNewObject) { + fl.WallReplyNew(func(ctx context.Context, _ events.WallReplyNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventWallReplyNew}, fl.ListEvents()) @@ -923,9 +923,9 @@ func TestFuncList_HandlerWallReplyEdit(t *testing.T) { fl := events.NewFuncList() - fl.WallReplyEdit(func(ctx context.Context, obj events.WallReplyEditObject) { + fl.WallReplyEdit(func(ctx context.Context, _ events.WallReplyEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventWallReplyEdit}, fl.ListEvents()) @@ -966,9 +966,9 @@ func TestFuncList_HandlerWallReplyRestore(t *testing.T) { fl := events.NewFuncList() - fl.WallReplyRestore(func(ctx context.Context, obj events.WallReplyRestoreObject) { + fl.WallReplyRestore(func(ctx context.Context, _ events.WallReplyRestoreObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventWallReplyRestore}, fl.ListEvents()) @@ -1009,9 +1009,9 @@ func TestFuncList_HandlerWallReplyDelete(t *testing.T) { fl := events.NewFuncList() - fl.WallReplyDelete(func(ctx context.Context, obj events.WallReplyDeleteObject) { + fl.WallReplyDelete(func(ctx context.Context, _ events.WallReplyDeleteObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventWallReplyDelete}, fl.ListEvents()) @@ -1052,9 +1052,9 @@ func TestFuncList_HandlerBoardPostNew(t *testing.T) { fl := events.NewFuncList() - fl.BoardPostNew(func(ctx context.Context, obj events.BoardPostNewObject) { + fl.BoardPostNew(func(ctx context.Context, _ events.BoardPostNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventBoardPostNew}, fl.ListEvents()) @@ -1095,9 +1095,9 @@ func TestFuncList_HandlerBoardPostEdit(t *testing.T) { fl := events.NewFuncList() - fl.BoardPostEdit(func(ctx context.Context, obj events.BoardPostEditObject) { + fl.BoardPostEdit(func(ctx context.Context, _ events.BoardPostEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventBoardPostEdit}, fl.ListEvents()) @@ -1138,9 +1138,9 @@ func TestFuncList_HandlerBoardPostRestore(t *testing.T) { fl := events.NewFuncList() - fl.BoardPostRestore(func(ctx context.Context, obj events.BoardPostRestoreObject) { + fl.BoardPostRestore(func(ctx context.Context, _ events.BoardPostRestoreObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventBoardPostRestore}, fl.ListEvents()) @@ -1181,9 +1181,9 @@ func TestFuncList_HandlerBoardPostDelete(t *testing.T) { fl := events.NewFuncList() - fl.BoardPostDelete(func(ctx context.Context, obj events.BoardPostDeleteObject) { + fl.BoardPostDelete(func(ctx context.Context, _ events.BoardPostDeleteObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventBoardPostDelete}, fl.ListEvents()) @@ -1224,9 +1224,9 @@ func TestFuncList_HandlerMarketCommentNew(t *testing.T) { fl := events.NewFuncList() - fl.MarketCommentNew(func(ctx context.Context, obj events.MarketCommentNewObject) { + fl.MarketCommentNew(func(ctx context.Context, _ events.MarketCommentNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMarketCommentNew}, fl.ListEvents()) @@ -1267,9 +1267,9 @@ func TestFuncList_HandlerMarketCommentEdit(t *testing.T) { fl := events.NewFuncList() - fl.MarketCommentEdit(func(ctx context.Context, obj events.MarketCommentEditObject) { + fl.MarketCommentEdit(func(ctx context.Context, _ events.MarketCommentEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMarketCommentEdit}, fl.ListEvents()) @@ -1310,9 +1310,9 @@ func TestFuncList_HandlerMarketCommentRestore(t *testing.T) { fl := events.NewFuncList() - fl.MarketCommentRestore(func(ctx context.Context, obj events.MarketCommentRestoreObject) { + fl.MarketCommentRestore(func(ctx context.Context, _ events.MarketCommentRestoreObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMarketCommentRestore}, fl.ListEvents()) @@ -1353,9 +1353,9 @@ func TestFuncList_HandlerMarketCommentDelete(t *testing.T) { fl := events.NewFuncList() - fl.MarketCommentDelete(func(ctx context.Context, obj events.MarketCommentDeleteObject) { + fl.MarketCommentDelete(func(ctx context.Context, _ events.MarketCommentDeleteObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMarketCommentDelete}, fl.ListEvents()) @@ -1396,9 +1396,9 @@ func TestFuncList_HandlerMarketOrderNew(t *testing.T) { fl := events.NewFuncList() - fl.MarketOrderNew(func(ctx context.Context, obj events.MarketOrderNewObject) { + fl.MarketOrderNew(func(ctx context.Context, _ events.MarketOrderNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMarketOrderNew}, fl.ListEvents()) @@ -1439,9 +1439,9 @@ func TestFuncList_HandlerMarketOrderEdit(t *testing.T) { fl := events.NewFuncList() - fl.MarketOrderEdit(func(ctx context.Context, obj events.MarketOrderEditObject) { + fl.MarketOrderEdit(func(ctx context.Context, _ events.MarketOrderEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMarketOrderEdit}, fl.ListEvents()) @@ -1482,9 +1482,9 @@ func TestFuncList_HandlerGroupLeave(t *testing.T) { fl := events.NewFuncList() - fl.GroupLeave(func(ctx context.Context, obj events.GroupLeaveObject) { + fl.GroupLeave(func(ctx context.Context, _ events.GroupLeaveObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventGroupLeave}, fl.ListEvents()) @@ -1525,9 +1525,9 @@ func TestFuncList_HandlerGroupJoin(t *testing.T) { fl := events.NewFuncList() - fl.GroupJoin(func(ctx context.Context, obj events.GroupJoinObject) { + fl.GroupJoin(func(ctx context.Context, _ events.GroupJoinObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventGroupJoin}, fl.ListEvents()) @@ -1568,9 +1568,9 @@ func TestFuncList_HandlerUserBlock(t *testing.T) { fl := events.NewFuncList() - fl.UserBlock(func(ctx context.Context, obj events.UserBlockObject) { + fl.UserBlock(func(ctx context.Context, _ events.UserBlockObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventUserBlock}, fl.ListEvents()) @@ -1611,9 +1611,9 @@ func TestFuncList_HandlerUserUnblock(t *testing.T) { fl := events.NewFuncList() - fl.UserUnblock(func(ctx context.Context, obj events.UserUnblockObject) { + fl.UserUnblock(func(ctx context.Context, _ events.UserUnblockObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventUserUnblock}, fl.ListEvents()) @@ -1654,9 +1654,9 @@ func TestFuncList_HandlerPollVoteNew(t *testing.T) { fl := events.NewFuncList() - fl.PollVoteNew(func(ctx context.Context, obj events.PollVoteNewObject) { + fl.PollVoteNew(func(ctx context.Context, _ events.PollVoteNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventPollVoteNew}, fl.ListEvents()) @@ -1697,9 +1697,9 @@ func TestFuncList_HandlerGroupOfficersEdit(t *testing.T) { fl := events.NewFuncList() - fl.GroupOfficersEdit(func(ctx context.Context, obj events.GroupOfficersEditObject) { + fl.GroupOfficersEdit(func(ctx context.Context, _ events.GroupOfficersEditObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventGroupOfficersEdit}, fl.ListEvents()) @@ -1740,9 +1740,9 @@ func TestFuncList_HandlerGroupChangeSettings(t *testing.T) { fl := events.NewFuncList() - fl.GroupChangeSettings(func(ctx context.Context, obj events.GroupChangeSettingsObject) { + fl.GroupChangeSettings(func(ctx context.Context, _ events.GroupChangeSettingsObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventGroupChangeSettings}, fl.ListEvents()) @@ -1783,9 +1783,9 @@ func TestFuncList_HandlerGroupChangePhoto(t *testing.T) { fl := events.NewFuncList() - fl.GroupChangePhoto(func(ctx context.Context, obj events.GroupChangePhotoObject) { + fl.GroupChangePhoto(func(ctx context.Context, _ events.GroupChangePhotoObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventGroupChangePhoto}, fl.ListEvents()) @@ -1826,9 +1826,9 @@ func TestFuncList_HandlerVkpayTransaction(t *testing.T) { fl := events.NewFuncList() - fl.VkpayTransaction(func(ctx context.Context, obj events.VkpayTransactionObject) { + fl.VkpayTransaction(func(ctx context.Context, _ events.VkpayTransactionObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventVkpayTransaction}, fl.ListEvents()) @@ -1869,9 +1869,9 @@ func TestFuncList_HandlerLeadFormsNew(t *testing.T) { fl := events.NewFuncList() - fl.LeadFormsNew(func(ctx context.Context, obj events.LeadFormsNewObject) { + fl.LeadFormsNew(func(ctx context.Context, _ events.LeadFormsNewObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventLeadFormsNew}, fl.ListEvents()) @@ -1912,9 +1912,9 @@ func TestFuncList_HandlerAppPayload(t *testing.T) { fl := events.NewFuncList() - fl.AppPayload(func(ctx context.Context, obj events.AppPayloadObject) { + fl.AppPayload(func(ctx context.Context, _ events.AppPayloadObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventAppPayload}, fl.ListEvents()) @@ -1955,9 +1955,9 @@ func TestFuncList_HandlerMessageRead(t *testing.T) { fl := events.NewFuncList() - fl.MessageRead(func(ctx context.Context, obj events.MessageReadObject) { + fl.MessageRead(func(ctx context.Context, _ events.MessageReadObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventMessageRead}, fl.ListEvents()) @@ -1998,9 +1998,9 @@ func TestFuncList_HandlerLikeAdd(t *testing.T) { fl := events.NewFuncList() - fl.LikeAdd(func(ctx context.Context, obj events.LikeAddObject) { + fl.LikeAdd(func(ctx context.Context, _ events.LikeAddObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventLikeAdd}, fl.ListEvents()) @@ -2041,9 +2041,9 @@ func TestFuncList_HandlerLikeRemove(t *testing.T) { fl := events.NewFuncList() - fl.LikeRemove(func(ctx context.Context, obj events.LikeRemoveObject) { + fl.LikeRemove(func(ctx context.Context, _ events.LikeRemoveObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventLikeRemove}, fl.ListEvents()) @@ -2084,9 +2084,9 @@ func TestFuncList_DonutSubscriptionCreate(t *testing.T) { fl := events.NewFuncList() - fl.DonutSubscriptionCreate(func(ctx context.Context, obj events.DonutSubscriptionCreateObject) { + fl.DonutSubscriptionCreate(func(ctx context.Context, _ events.DonutSubscriptionCreateObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventDonutSubscriptionCreate}, fl.ListEvents()) @@ -2127,9 +2127,9 @@ func TestFuncList_DonutSubscriptionProlonged(t *testing.T) { fl := events.NewFuncList() - fl.DonutSubscriptionProlonged(func(ctx context.Context, obj events.DonutSubscriptionProlongedObject) { + fl.DonutSubscriptionProlonged(func(ctx context.Context, _ events.DonutSubscriptionProlongedObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventDonutSubscriptionProlonged}, fl.ListEvents()) @@ -2170,9 +2170,9 @@ func TestFuncList_DonutSubscriptionExpired(t *testing.T) { fl := events.NewFuncList() - fl.DonutSubscriptionExpired(func(ctx context.Context, obj events.DonutSubscriptionExpiredObject) { + fl.DonutSubscriptionExpired(func(ctx context.Context, _ events.DonutSubscriptionExpiredObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventDonutSubscriptionExpired}, fl.ListEvents()) @@ -2213,9 +2213,9 @@ func TestFuncList_DonutSubscriptionCancelled(t *testing.T) { fl := events.NewFuncList() - fl.DonutSubscriptionCancelled(func(ctx context.Context, obj events.DonutSubscriptionCancelledObject) { + fl.DonutSubscriptionCancelled(func(ctx context.Context, _ events.DonutSubscriptionCancelledObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventDonutSubscriptionCancelled}, fl.ListEvents()) @@ -2256,9 +2256,9 @@ func TestFuncList_DonutSubscriptionPriceChanged(t *testing.T) { fl := events.NewFuncList() - fl.DonutSubscriptionPriceChanged(func(ctx context.Context, obj events.DonutSubscriptionPriceChangedObject) { + fl.DonutSubscriptionPriceChanged(func(ctx context.Context, _ events.DonutSubscriptionPriceChangedObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventDonutSubscriptionPriceChanged}, fl.ListEvents()) @@ -2299,9 +2299,9 @@ func TestFuncList_DonutMoneyWithdraw(t *testing.T) { fl := events.NewFuncList() - fl.DonutMoneyWithdraw(func(ctx context.Context, obj events.DonutMoneyWithdrawObject) { + fl.DonutMoneyWithdraw(func(ctx context.Context, _ events.DonutMoneyWithdrawObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventDonutMoneyWithdraw}, fl.ListEvents()) @@ -2342,9 +2342,9 @@ func TestFuncList_DonutMoneyWithdrawError(t *testing.T) { fl := events.NewFuncList() - fl.DonutMoneyWithdrawError(func(ctx context.Context, obj events.DonutMoneyWithdrawErrorObject) { + fl.DonutMoneyWithdrawError(func(ctx context.Context, _ events.DonutMoneyWithdrawErrorObject) { groupID := events.GroupIDFromContext(ctx) - assert.Equal(t, groupID, GID) + assert.Equal(t, GID, groupID) }) assert.Equal(t, []events.EventType{events.EventDonutMoneyWithdrawError}, fl.ListEvents()) diff --git a/games/verify_test.go b/games/verify_test.go index aaa2924b..2044aaf2 100644 --- a/games/verify_test.go +++ b/games/verify_test.go @@ -53,7 +53,7 @@ func TestParamsVerification_VerifyMiddleware(t *testing.T) { pv := games.NewParamsVerification("TaWz5vVHUQnp7YgtuRlS") - handlerOk := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + handlerOk := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write([]byte("ok")) }) diff --git a/internal/transport_test.go b/internal/transport_test.go index f77a3bf6..4ef24ff0 100644 --- a/internal/transport_test.go +++ b/internal/transport_test.go @@ -48,7 +48,7 @@ func TestContextClient(t *testing.T) { func TestGo17Context(t *testing.T) { t.Parallel() - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { io.WriteString(w, "ok") })) defer ts.Close() @@ -113,7 +113,7 @@ func TestCancelBeforeHeaders(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) blockServer := make(chan struct{}) - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { cancel() <-blockServer diff --git a/longpoll-bot/longpoll_test.go b/longpoll-bot/longpoll_test.go index 431f6378..827cdb1b 100644 --- a/longpoll-bot/longpoll_test.go +++ b/longpoll-bot/longpoll_test.go @@ -29,7 +29,7 @@ func TestLongPoll_Shutdown(t *testing.T) { vk := api.NewVK(groupToken) lp, _ := NewLongPollCommunity(vk) - lp.MessageNew(func(ctx context.Context, obj events.MessageNewObject) { + lp.MessageNew(func(_ context.Context, _ events.MessageNewObject) { lp.Shutdown() }) @@ -71,7 +71,7 @@ func TestLongPoll_Handler(t *testing.T) { //nolint:gocyclo lp := &LongPoll{} - lp.FullResponse(func(resp Response) {}) + lp.FullResponse(func(_ Response) {}) if len(lp.funcFullResponseList) != 1 { t.Error("Want len = 1") @@ -119,6 +119,7 @@ func TestNewLongPollCommunity(t *testing.T) { if groupToken == "" { t.Skip("GROUP_TOKEN empty") } + f(api.NewVK(groupToken), false) }) t.Run("userToken", func(t *testing.T) { @@ -128,6 +129,7 @@ func TestNewLongPollCommunity(t *testing.T) { if userToken == "" { t.Skip("USER_TOKEN empty") } + f(api.NewVK(userToken), true) }) } diff --git a/longpoll-user/longpoll.go b/longpoll-user/longpoll.go index 4917492e..a116398b 100644 --- a/longpoll-user/longpoll.go +++ b/longpoll-user/longpoll.go @@ -149,7 +149,7 @@ func (lp *LongPoll) updateServer(updateTs bool) error { func (lp *LongPoll) check() (response object.LongPollResponse, err error) { u, err := url.Parse(lp.Server) if err != nil { - return + return response, err } u.Scheme = "https" @@ -165,20 +165,20 @@ func (lp *LongPoll) check() (response object.LongPollResponse, err error) { req, err := http.NewRequest(http.MethodGet, u.String(), nil) if err != nil { - return + return response, err } req.Header.Set("User-Agent", lp.UserAgent) resp, err := lp.Client.Do(req) if err != nil { - return + return response, err } defer resp.Body.Close() err = json.NewDecoder(resp.Body).Decode(&response) if err != nil { - return + return response, err } err = lp.checkResponse(response) diff --git a/longpoll-user/v3/wrapper_test.go b/longpoll-user/v3/wrapper_test.go index b13979fa..3c209ac7 100644 --- a/longpoll-user/v3/wrapper_test.go +++ b/longpoll-user/v3/wrapper_test.go @@ -79,7 +79,7 @@ func TestWrapper(t *testing.T) { w := wrapper.NewWrapper(lp) - w.OnMessageFlagsChange(func(e wrapper.MessageFlagsChange) {}) + w.OnMessageFlagsChange(func(_ wrapper.MessageFlagsChange) {}) w.OnMessageFlagsSet(func(e wrapper.MessageFlagsSet) { assert.NotEmpty(t, e.MessageID) assert.NotEmpty(t, e.Mask) @@ -102,15 +102,15 @@ func TestWrapper(t *testing.T) { assert.NotEmpty(t, e.Timestamp) assert.NotEmpty(t, e.NewText) }) - w.OnReadInMessages(func(e wrapper.ReadInMessages) {}) - w.OnReadOutMessages(func(e wrapper.ReadOutMessages) {}) - w.OnFriendBecameOnline(func(e wrapper.FriendBecameOnline) {}) - w.OnFriendBecameOffline(func(e wrapper.FriendBecameOffline) {}) - w.OnDialogFlagsReset(func(e wrapper.DialogFlagsReset) {}) - w.OnDialogFlagsReplace(func(e wrapper.DialogFlagsReplace) {}) - w.OnDialogsFlagsSet(func(e wrapper.DialogsFlagsSet) {}) - w.OnDeleteMessages(func(e wrapper.DeleteMessages) {}) - w.OnRestoreDeletedMessages(func(e wrapper.RestoreDeletedMessages) {}) + w.OnReadInMessages(func(_ wrapper.ReadInMessages) {}) + w.OnReadOutMessages(func(_ wrapper.ReadOutMessages) {}) + w.OnFriendBecameOnline(func(_ wrapper.FriendBecameOnline) {}) + w.OnFriendBecameOffline(func(_ wrapper.FriendBecameOffline) {}) + w.OnDialogFlagsReset(func(_ wrapper.DialogFlagsReset) {}) + w.OnDialogFlagsReplace(func(_ wrapper.DialogFlagsReplace) {}) + w.OnDialogsFlagsSet(func(_ wrapper.DialogsFlagsSet) {}) + w.OnDeleteMessages(func(_ wrapper.DeleteMessages) {}) + w.OnRestoreDeletedMessages(func(_ wrapper.RestoreDeletedMessages) {}) w.OnChatParamsChange(func(e wrapper.ChatParamsChange) { assert.NotEmpty(t, e.ChatID) }) @@ -118,15 +118,14 @@ func TestWrapper(t *testing.T) { assert.NotEmpty(t, e.TypeID) assert.NotEmpty(t, e.PeerID) lp.Shutdown() - // assert.NotEmpty(t, e.Info) }) - w.OnUserTyping(func(e wrapper.UserTyping) {}) - w.OnUserTypingChat(func(e wrapper.UserTypingChat) {}) - w.OnUsersTyping(func(e wrapper.UsersTyping) {}) - w.OnUsersRecordingAudioMessage(func(e wrapper.UsersRecordingAudioMessage) {}) - w.OnUserCall(func(e wrapper.UserCall) {}) - w.OnCounterChange(func(e wrapper.CounterChange) {}) - w.OnNotificationSettingsChange(func(e wrapper.NotificationSettingsChange) {}) + w.OnUserTyping(func(_ wrapper.UserTyping) {}) + w.OnUserTypingChat(func(_ wrapper.UserTypingChat) {}) + w.OnUsersTyping(func(_ wrapper.UsersTyping) {}) + w.OnUsersRecordingAudioMessage(func(_ wrapper.UsersRecordingAudioMessage) {}) + w.OnUserCall(func(_ wrapper.UserCall) {}) + w.OnCounterChange(func(_ wrapper.CounterChange) {}) + w.OnNotificationSettingsChange(func(_ wrapper.NotificationSettingsChange) {}) f := func() { lp := lp diff --git a/marusia/skill_test.go b/marusia/skill_test.go index 19cad048..b370e1e2 100644 --- a/marusia/skill_test.go +++ b/marusia/skill_test.go @@ -112,10 +112,7 @@ func TestSpeakerAudio(t *testing.T) { } func ExampleSpeakerAudioVKID() { - tts := fmt.Sprintf( - "Угадайте, чей это голос? %s", - marusia.SpeakerAudioVKID("-2000000002_123456789"), - ) + tts := "Угадайте, чей это голос? " + marusia.SpeakerAudioVKID("-2000000002_123456789") fmt.Println(tts) // Output: diff --git a/marusia/webhook_test.go b/marusia/webhook_test.go index 389d6fe8..89eccd35 100644 --- a/marusia/webhook_test.go +++ b/marusia/webhook_test.go @@ -56,8 +56,10 @@ func TestWebhook(t *testing.T) { wh.OnEvent(func(r marusia.Request) (resp marusia.Response) { assert.Equal(t, "command", r.Request.Command) + resp.Text = "text" resp.TTS = "tts" + return }) f( @@ -81,7 +83,7 @@ func TestWebhookBadContentType(t *testing.T) { wh := marusia.NewWebhook() - req, err := http.NewRequest(http.MethodPost, "/webhook", bytes.NewBuffer([]byte("test"))) + req, err := http.NewRequest(http.MethodPost, "/webhook", bytes.NewBufferString("test")) assert.NoError(t, err) req.Header.Set("Content-Type", "text/plain; encoding=utf-8") @@ -98,7 +100,7 @@ func TestWebhookBadJSON(t *testing.T) { wh := marusia.NewWebhook() - req, err := http.NewRequest(http.MethodPost, "/webhook", bytes.NewBuffer([]byte("[]"))) + req, err := http.NewRequest(http.MethodPost, "/webhook", bytes.NewBufferString("[]")) assert.NoError(t, err) req.Header.Set("Content-Type", "application/json; encoding=utf-8") @@ -116,7 +118,7 @@ func TestWebhookCors(t *testing.T) { wh := marusia.NewWebhook() wh.EnableDebuging() - req, err := http.NewRequest(http.MethodOptions, "/webhook", bytes.NewBuffer([]byte("[]"))) + req, err := http.NewRequest(http.MethodOptions, "/webhook", bytes.NewBufferString("[]")) assert.NoError(t, err) rr := httptest.NewRecorder() diff --git a/object/groups.go b/object/groups.go index 8f1636b4..738cc18b 100644 --- a/object/groups.go +++ b/object/groups.go @@ -244,7 +244,7 @@ type GroupsGroupLikeFriends struct { type GroupsLiveCovers struct { IsEnabled BaseBoolInt `json:"is_enabled"` IsScalable BaseBoolInt `json:"is_scalable"` - StoryIds []string `json:"story_ids"` + StoryIds []string `json:"story_ids"` //nolint:revive } // GroupsBanInfo reason type. @@ -607,7 +607,7 @@ type GroupsYoulaSettings struct { ModerationStatus int `json:"moderation_status"` DeclineReason string `json:"decline_reason"` GroupMode int `json:"group_mode"` - SelectedCategoryIDS []int `json:"selected_category_ids"` + SelectedCategoryIDS []int `json:"selected_category_ids"` //nolint:revive Lat float64 `json:"lat"` Long float64 `json:"long"` Radius float64 `json:"radius"` diff --git a/object/messages_test.go b/object/messages_test.go index 3d4db1d7..e7a74d7f 100644 --- a/object/messages_test.go +++ b/object/messages_test.go @@ -34,9 +34,9 @@ func TestMessagesKeyboard_AddTextButton(t *testing.T) { keyboard.AddRow() keyboard.AddTextButton(label, payload, color) - assert.Equal(t, keyboard.Buttons[0][0].Color, color) - assert.Equal(t, keyboard.Buttons[0][0].Action.Label, label) - assert.Equal(t, keyboard.Buttons[0][0].Action.Payload, `"`+payload+`"`) + assert.Equal(t, color, keyboard.Buttons[0][0].Color) + assert.Equal(t, label, keyboard.Buttons[0][0].Action.Label) + assert.Equal(t, `"`+payload+`"`, keyboard.Buttons[0][0].Action.Payload) } func TestMessagesKeyboard_AddTextButton_Panic(t *testing.T) { @@ -67,9 +67,9 @@ func TestMessagesKeyboard_AddOpenLinkButton(t *testing.T) { keyboard.AddRow() keyboard.AddOpenLinkButton(link, label, payload) - assert.Equal(t, keyboard.Buttons[0][0].Action.Payload, `"`+payload+`"`) - assert.Equal(t, keyboard.Buttons[0][0].Action.Label, label) - assert.Equal(t, keyboard.Buttons[0][0].Action.Link, link) + assert.Equal(t, `"`+payload+`"`, keyboard.Buttons[0][0].Action.Payload) + assert.Equal(t, label, keyboard.Buttons[0][0].Action.Label) + assert.Equal(t, link, keyboard.Buttons[0][0].Action.Link) } func TestMessagesKeyboard_AddOpenLinkButton_Panic(t *testing.T) { @@ -96,7 +96,7 @@ func TestMessagesKeyboard_AddLocationButton(t *testing.T) { keyboard.AddRow() keyboard.AddLocationButton(payload) - assert.Equal(t, keyboard.Buttons[0][0].Action.Payload, `"`+payload+`"`) + assert.Equal(t, `"`+payload+`"`, keyboard.Buttons[0][0].Action.Payload) } func TestMessagesKeyboard_AddLocationButton_Panic(t *testing.T) { @@ -126,8 +126,8 @@ func TestMessagesKeyboard_AddVKPayButton(t *testing.T) { keyboard.AddRow() keyboard.AddVKPayButton(payload, hash) - assert.Equal(t, keyboard.Buttons[0][0].Action.Payload, `"`+payload+`"`) - assert.Equal(t, keyboard.Buttons[0][0].Action.Hash, hash) + assert.Equal(t, `"`+payload+`"`, keyboard.Buttons[0][0].Action.Payload) + assert.Equal(t, hash, keyboard.Buttons[0][0].Action.Hash) } func TestMessagesKeyboard_AddVKPayButton_Panic(t *testing.T) { @@ -160,11 +160,11 @@ func TestMessagesKeyboard_AddVKAppsButton(t *testing.T) { keyboard.AddRow() keyboard.AddVKAppsButton(appID, ownerID, payload, label, hash) - assert.Equal(t, keyboard.Buttons[0][0].Action.AppID, appID) - assert.Equal(t, keyboard.Buttons[0][0].Action.OwnerID, ownerID) - assert.Equal(t, keyboard.Buttons[0][0].Action.Payload, `"`+payload+`"`) - assert.Equal(t, keyboard.Buttons[0][0].Action.Label, label) - assert.Equal(t, keyboard.Buttons[0][0].Action.Hash, hash) + assert.Equal(t, appID, keyboard.Buttons[0][0].Action.AppID) + assert.Equal(t, ownerID, keyboard.Buttons[0][0].Action.OwnerID) + assert.Equal(t, `"`+payload+`"`, keyboard.Buttons[0][0].Action.Payload) + assert.Equal(t, label, keyboard.Buttons[0][0].Action.Label) + assert.Equal(t, hash, keyboard.Buttons[0][0].Action.Hash) } func TestMessagesKeyboard_AddVKAppsButton_Panic(t *testing.T) { @@ -195,9 +195,9 @@ func TestMessagesKeyboard_AddCallbackButton(t *testing.T) { keyboard.AddRow() keyboard.AddCallbackButton(label, payload, color) - assert.Equal(t, keyboard.Buttons[0][0].Color, color) - assert.Equal(t, keyboard.Buttons[0][0].Action.Label, label) - assert.Equal(t, keyboard.Buttons[0][0].Action.Payload, `"`+payload+`"`) + assert.Equal(t, color, keyboard.Buttons[0][0].Color) + assert.Equal(t, label, keyboard.Buttons[0][0].Action.Label) + assert.Equal(t, `"`+payload+`"`, keyboard.Buttons[0][0].Action.Payload) } func TestMessagesKeyboard_AddCallbackButton_Panic(t *testing.T) { @@ -247,7 +247,7 @@ func TestMessagesKeyboard_ToJSON(t *testing.T) { t.Helper() got := keyboard.ToJSON() - assert.Equal(t, got, want) + assert.Equal(t, want, got) } f( @@ -271,7 +271,7 @@ func TestMessagesTemplate_ToJSON(t *testing.T) { t.Helper() got := template.ToJSON() - assert.Equal(t, got, want) + assert.Equal(t, want, got) } f( @@ -287,7 +287,7 @@ func TestMessageContentSource_ToJSON(t *testing.T) { t.Helper() got := cs.ToJSON() - assert.Equal(t, got, want) + assert.Equal(t, want, got) } f( @@ -307,7 +307,7 @@ func TestMessagesEventData_ToJSON(t *testing.T) { t.Helper() got := eventData.ToJSON() - assert.Equal(t, got, want) + assert.Equal(t, want, got) } f( @@ -335,7 +335,7 @@ func TestMessagesForward_ToJSON(t *testing.T) { t.Helper() got := forward.ToJSON() - assert.Equal(t, got, want) + assert.Equal(t, want, got) } f( diff --git a/object/object_test.go b/object/object_test.go index 3bde1e01..c0651eb6 100644 --- a/object/object_test.go +++ b/object/object_test.go @@ -323,11 +323,14 @@ func TestBaseSticker_MinSizeBackground(t *testing.T) { } func TestBaseLinkRating_UnmarshalJSON(t *testing.T) { + t.Parallel() + ratingJSON := []byte(`{"reviews_count":1.0,"stars":5.0}`) + var rating object.BaseLinkRating assert.NoError(t, json.Unmarshal(ratingJSON, &rating)) review, _ := rating.ReviewsCount.Float64() - assert.Equal(t, 1.0, review) - assert.Equal(t, 5.0, rating.Stars) + assert.InEpsilon(t, 1.0, review, 0.1) + assert.InEpsilon(t, 5.0, rating.Stars, 0.1) } diff --git a/payments/callback_test.go b/payments/callback_test.go index 1b0fc614..65ef07fb 100644 --- a/payments/callback_test.go +++ b/payments/callback_test.go @@ -135,11 +135,11 @@ func TestCallback_OnGetItem(t *testing.T) { cb := payments.NewCallback(secret) assert.Equal(t, secret, cb.Secret) - cb.OnGetItem(func(e payments.GetItemRequest) (*payments.GetItemResponse, *payments.Error) { + cb.OnGetItem(func(_ payments.GetItemRequest) (*payments.GetItemResponse, *payments.Error) { return nil, &paymentErr }) - cb.OnGetItemTest(func(e payments.GetItemRequest) (*payments.GetItemResponse, *payments.Error) { + cb.OnGetItemTest(func(_ payments.GetItemRequest) (*payments.GetItemResponse, *payments.Error) { return nil, &paymentErr }) @@ -246,11 +246,11 @@ func TestCallback_OnGetSubscription(t *testing.T) { cb := payments.NewCallback(secret) assert.Equal(t, secret, cb.Secret) - cb.OnGetSubscription(func(e payments.GetSubscriptionRequest) (*payments.GetSubscriptionResponse, *payments.Error) { + cb.OnGetSubscription(func(_ payments.GetSubscriptionRequest) (*payments.GetSubscriptionResponse, *payments.Error) { return nil, &paymentErr }) - cb.OnGetSubscriptionTest(func(e payments.GetSubscriptionRequest) (*payments.GetSubscriptionResponse, *payments.Error) { + cb.OnGetSubscriptionTest(func(_ payments.GetSubscriptionRequest) (*payments.GetSubscriptionResponse, *payments.Error) { return nil, &paymentErr }) @@ -360,14 +360,14 @@ func TestCallback_OnOrderStatusChange(t *testing.T) { cb := payments.NewCallback(secret) assert.Equal(t, secret, cb.Secret) - cb.OnOrderStatusChange(func(e payments.OrderStatusChangeRequest) ( + cb.OnOrderStatusChange(func(_ payments.OrderStatusChangeRequest) ( *payments.OrderStatusChangeResponse, *payments.Error, ) { return nil, &paymentErr }) - cb.OnOrderStatusChangeTest(func(e payments.OrderStatusChangeRequest) ( + cb.OnOrderStatusChangeTest(func(_ payments.OrderStatusChangeRequest) ( *payments.OrderStatusChangeResponse, *payments.Error, ) { @@ -492,14 +492,14 @@ func TestCallback_OnSubscriptionStatusChange(t *testing.T) { cb := payments.NewCallback(secret) assert.Equal(t, secret, cb.Secret) - cb.OnSubscriptionStatusChange(func(e payments.SubscriptionStatusChangeRequest) ( + cb.OnSubscriptionStatusChange(func(_ payments.SubscriptionStatusChangeRequest) ( *payments.SubscriptionStatusChangeResponse, *payments.Error, ) { return nil, &paymentErr }) - cb.OnSubscriptionStatusChangeTest(func(e payments.SubscriptionStatusChangeRequest) ( + cb.OnSubscriptionStatusChangeTest(func(_ payments.SubscriptionStatusChangeRequest) ( *payments.SubscriptionStatusChangeResponse, *payments.Error, ) { diff --git a/streaming/streaming.go b/streaming/streaming.go index 41e239be..3ae877d2 100644 --- a/streaming/streaming.go +++ b/streaming/streaming.go @@ -311,6 +311,7 @@ func (s *Streaming) Run() error { return err } + defer wsResp.Body.Close() defer c.Close() diff --git a/streaming/streaming_test.go b/streaming/streaming_test.go index eefaa4c1..455ca988 100644 --- a/streaming/streaming_test.go +++ b/streaming/streaming_test.go @@ -126,7 +126,7 @@ func TestStreaming_OnEvent(t *testing.T) { t.Parallel() s := &streaming.Streaming{} - s.OnEvent(func(e streaming.Event) {}) + s.OnEvent(func(_ streaming.Event) {}) } func TestStreaming_Run(t *testing.T) { //nolint:paralleltest @@ -144,7 +144,7 @@ func TestStreaming_Run(t *testing.T) { //nolint:paralleltest return } - stream.OnEvent(func(e streaming.Event) { + stream.OnEvent(func(_ streaming.Event) { // TODO: assert good <- true }) diff --git a/vkapps/params_test.go b/vkapps/params_test.go index 71ac7596..e7664220 100644 --- a/vkapps/params_test.go +++ b/vkapps/params_test.go @@ -21,9 +21,9 @@ func TestParams(t *testing.T) { assert.Equal(t, "notify,menu", params.VkAccessTokenSettings) assert.Equal(t, 7573302, params.VkAppID) - assert.Equal(t, false, params.VkAreNotificationsEnabled) - assert.Equal(t, true, params.VkIsAppUser) - assert.Equal(t, false, params.VkIsFavorite) + assert.False(t, params.VkAreNotificationsEnabled) + assert.True(t, params.VkIsAppUser) + assert.False(t, params.VkIsFavorite) assert.Equal(t, "ru", params.VkLanguage) assert.Equal(t, vkapps.DesktopWeb, params.VkPlatform) assert.Equal(t, vkapps.LeftNav, params.VkRef) diff --git a/vkapps/verify_test.go b/vkapps/verify_test.go index 9533a515..616fb40f 100644 --- a/vkapps/verify_test.go +++ b/vkapps/verify_test.go @@ -59,7 +59,7 @@ func TestParamsVerification_VerifyMiddleware(t *testing.T) { pv := vkapps.NewParamsVerification("wvl68m4dR1UpLrVRli") - handlerOk := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + handlerOk := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write([]byte("ok")) })