diff --git a/internalsdk/pro/pro.go b/internalsdk/pro/pro.go index 6e59bc8d8..a85ef79cf 100644 --- a/internalsdk/pro/pro.go +++ b/internalsdk/pro/pro.go @@ -243,7 +243,9 @@ func (c *proClient) RedeemResellerCode(ctx context.Context, req *protos.RedeemRe log.Errorf("Failed to redeem reseller code: %v", err) return nil, err } - + if resp.Error != "" { + return nil, errors.New("error redeeming reseller code: %v", resp.Error) + } return &resp, nil } diff --git a/internalsdk/pro/pro_test.go b/internalsdk/pro/pro_test.go index d5c7de257..4e978e314 100644 --- a/internalsdk/pro/pro_test.go +++ b/internalsdk/pro/pro_test.go @@ -1,99 +1,91 @@ package pro -import ( - "context" - "net/http" - "testing" +// Todo +// @Paul we might need to find way to use mock here rather calling actual api +// Using actual api will be slow and also it will created redundant data in db +// func TestClient(t *testing.T) { +// log := golog.LoggerFor("pro-http-test") +// client := NewClient("https://api.getiantem.org", &Opts{ +// // Just use the default transport since otherwise test setup is difficult. +// // This means it does not actually touch the proxying code, but that should +// // be tested separately. +// HttpClient: &http.Client{}, +// UserConfig: func() common.UserConfig { +// return common.NewUserConfig( +// "Lantern", +// "device123", // deviceID +// 123, // userID +// "token", // token +// nil, +// "en", // language +// ) +// }, +// }) +// res, e := client.Plans(context.Background()) +// if !assert.NoError(t, e) { +// return +// } +// log.Debugf("Got response: %v", res) +// assert.NotNil(t, res) +// } - "github.com/getlantern/golog" - "github.com/getlantern/lantern-client/internalsdk/common" - "github.com/getlantern/lantern-client/internalsdk/protos" - "github.com/stretchr/testify/assert" -) +// func TestLinkValidate(t *testing.T) { +// log := golog.LoggerFor("pro-http-test") +// client := NewClient("https://api.getiantem.org", &Opts{ +// // Just use the default transport since otherwise test setup is difficult. +// // This means it does not actually touch the proxying code, but that should +// // be tested separately. +// HttpClient: &http.Client{}, +// UserConfig: func() common.UserConfig { +// return common.NewUserConfig( +// "Lantern", +// "device123", // deviceID +// 123, // userID +// "token", // token +// nil, +// "en", // language +// ) +// }, +// }) +// prepareRequestBody := &protos.ValidateRecoveryCodeRequest{ +// Email: "jigar@getlanern.org", +// Code: "123456", +// } +// res, e := client.ValidateEmailRecoveryCode(context.Background(), prepareRequestBody) +// if !assert.NoError(t, e) { +// return +// } +// log.Debugf("Got response: %v", res) +// assert.NotNil(t, res) +// } -func TestClient(t *testing.T) { - log := golog.LoggerFor("pro-http-test") - client := NewClient("https://api.getiantem.org", &Opts{ - // Just use the default transport since otherwise test setup is difficult. - // This means it does not actually touch the proxying code, but that should - // be tested separately. - HttpClient: &http.Client{}, - UserConfig: func() common.UserConfig { - return common.NewUserConfig( - "Lantern", - "device123", // deviceID - 123, // userID - "token", // token - nil, - "en", // language - ) - }, - }) - res, e := client.Plans(context.Background()) - if !assert.NoError(t, e) { - return - } - log.Debugf("Got response: %v", res) - assert.NotNil(t, res) -} - -func TestLinkValidate(t *testing.T) { - log := golog.LoggerFor("pro-http-test") - client := NewClient("https://api.getiantem.org", &Opts{ - // Just use the default transport since otherwise test setup is difficult. - // This means it does not actually touch the proxying code, but that should - // be tested separately. - HttpClient: &http.Client{}, - UserConfig: func() common.UserConfig { - return common.NewUserConfig( - "Lantern", - "device123", // deviceID - 123, // userID - "token", // token - nil, - "en", // language - ) - }, - }) - prepareRequestBody := &protos.ValidateRecoveryCodeRequest{ - Email: "jigar@getlanern.org", - Code: "123456", - } - res, e := client.ValidateEmailRecoveryCode(context.Background(), prepareRequestBody) - if !assert.NoError(t, e) { - return - } - log.Debugf("Got response: %v", res) - assert.NotNil(t, res) -} - -func TestSignUp(t *testing.T) { - log := golog.LoggerFor("pro-http-test") - client := NewClient("https://api.getiantem.org", &Opts{ - // Just use the default transport since otherwise test setup is difficult. - // This means it does not actually touch the proxying code, but that should - // be tested separately. - HttpClient: &http.Client{}, - UserConfig: func() common.UserConfig { - return common.NewUserConfig( - "Lantern", - "device123", // deviceID - 123, // userID - "token", // token - nil, - "en", // language - ) - }, - }) - prepareRequestBody := &protos.SignupRequest{ - Email: "jigar@getlanern.org", - Salt: []byte("salt"), - Verifier: []byte("verifier"), - } - res, e := client.SignUp(context.Background(), prepareRequestBody) - if !assert.NoError(t, e) { - return - } - log.Debugf("Got response: %v", res) - assert.NotNil(t, res) -} +// func TestSignUp(t *testing.T) { +// log := golog.LoggerFor("pro-http-test") +// client := NewClient("https://api.getiantem.org", &Opts{ +// // Just use the default transport since otherwise test setup is difficult. +// // This means it does not actually touch the proxying code, but that should +// // be tested separately. +// HttpClient: &http.Client{}, +// UserConfig: func() common.UserConfig { +// return common.NewUserConfig( +// "Lantern", +// "device123", // deviceID +// 123, // userID +// "token", // token +// nil, +// "en", // language +// ) +// }, +// }) +// prepareRequestBody := &protos.SignupRequest{ +// Email: "jigar@getlanern.org", +// Salt: []byte("salt"), +// Verifier: []byte("verifier"), +// } +// res, e := client.SignUp(context.Background(), prepareRequestBody) +// if !assert.NoError(t, e) { +// return +// } +// log.Debugf("Got response: %v", res) +// assert.NotNil(t, res) +// } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8436ee1ff..7be9141f1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -44,6 +44,11 @@ PODS: - DKImagePickerController/PhotoGallery - Flutter - Flutter (1.0.0) + - flutter_image_compress_common (1.0.0): + - Flutter + - Mantle + - SDWebImage + - SDWebImageWebPCoder - flutter_inappwebview_ios (0.0.1): - Flutter - flutter_inappwebview_ios/Core (= 0.0.1) @@ -92,6 +97,9 @@ PODS: - libwebp/sharpyuv (1.3.2) - libwebp/webp (1.3.2): - libwebp/sharpyuv + - Mantle (2.2.0): + - Mantle/extobjc (= 2.2.0) + - Mantle/extobjc (2.2.0) - MTBBarcodeScanner (5.0.11) - OrderedSet (5.0.0) - package_info_plus (0.4.5): @@ -107,6 +115,9 @@ PODS: - SDWebImage (5.19.2): - SDWebImage/Core (= 5.19.2) - SDWebImage/Core (5.19.2) + - SDWebImageWebPCoder (0.14.6): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.17) - Sentry/HybridSDK (8.21.0): - SentryPrivate (= 8.21.0) - sentry_flutter (0.0.1): @@ -145,6 +156,7 @@ DEPENDENCIES: - emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) + - flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`) - flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) @@ -181,9 +193,11 @@ SPEC REPOS: - Google-Mobile-Ads-SDK - GoogleUserMessagingPlatform - libwebp + - Mantle - MTBBarcodeScanner - OrderedSet - SDWebImage + - SDWebImageWebPCoder - Sentry - SentryPrivate - SwiftyGif @@ -203,6 +217,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/file_picker/ios" Flutter: :path: Flutter + flutter_image_compress_common: + :path: ".symlinks/plugins/flutter_image_compress_common/ios" flutter_inappwebview_ios: :path: ".symlinks/plugins/flutter_inappwebview_ios/ios" flutter_keyboard_visibility: @@ -261,6 +277,7 @@ SPEC CHECKSUMS: emoji_picker_flutter: fe2e6151c5b548e975d546e6eeb567daf0962a58 file_picker: ce3938a0df3cc1ef404671531facef740d03f920 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 @@ -275,6 +292,7 @@ SPEC CHECKSUMS: in_app_purchase_storekit: 4fb7ee9e824b1f09107fbfbbce8c4b276366dc43 integration_test: 13825b8a9334a850581300559b8839134b124670 libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009 + Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7 @@ -282,6 +300,7 @@ SPEC CHECKSUMS: permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a + SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380 Sentry: ebc12276bd17613a114ab359074096b6b3725203 sentry_flutter: dff1df05dc39c83d04f9330b36360fc374574c5e SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe