feat: UploadLeadFormsPhoto
This closes
@@ -473,8 +473,8 @@ func TestVK_UploadOwnerPollsPhoto(t *testing.T) {
}
func TestVK_UploadPrettyCardsPhoto(t *testing.T) {
- if vkUser.AccessToken == "" && vkGroupID == 0 {
- t.Skip("USER_TOKEN or GROUP_ID empty")
+ if vkUser.AccessToken == "" {
+ t.Skip("USER_TOKEN empty")
}
response, err := http.Get(photoURL)
@@ -489,6 +489,23 @@ func TestVK_UploadPrettyCardsPhoto(t *testing.T) {
}
}
+func TestVK_UploadLeadFormsPhoto(t *testing.T) {
+ if vkUser.AccessToken == "" {
+ t.Skip("USER_TOKEN empty")
+ }
+
+ response, err := http.Get(photoURL)
+ if err != nil {
+ t.Fatalf("%v", err)
+ }
+ defer response.Body.Close()
+
+ _, err = vkUser.UploadLeadFormsPhoto(response.Body)
+ if err != nil {
+ t.Errorf("VK.UploadLeadFormsPhoto() err = %v", err)
+ }
+}
+
func TestVK_Upload_Error(t *testing.T) {
vk := Init("")
@@ -580,4 +597,9 @@ func TestVK_Upload_Error(t *testing.T) {
if errors.GetType(err) != errors.Auth {
t.Errorf("VK.UploadPrettyCardsPhoto() err = %v, want %v", err, 5)
}
+
+ _, err = vk.UploadLeadFormsPhoto(new(bytes.Buffer))
+ if errors.GetType(err) != errors.Auth {
+ t.Errorf("VK.UploadLeadFormsPhoto() err = %v, want %v", err, 5)
+ }
}
