@@ -47,32 +47,31 @@ func Test_GetAccountRenewInvoiceHandler_Returns_Invoice(t *testing.T) {
47
47
assert .Contains (t , w .Body .String (), `"opqInvoice":{"cost":16,` )
48
48
}
49
49
50
- // TODO: re-enable this for the actual release
51
- //func Test_GetAccountRenewInvoiceHandler_ReturnsErrorIfExpirationDateTooFarInFuture(t *testing.T) {
52
- // models.DeleteAccountsForTest(t)
53
- // models.DeleteRenewalsForTest(t)
54
- //
55
- // getInvoiceObj := getRenewalAccountInvoiceObject{}
56
- //
57
- // v, b, _ := returnValidVerificationAndRequestBodyWithRandomPrivateKey(t, getInvoiceObj)
58
- //
59
- // getInvoiceReq := getRenewalAccountInvoiceReq{
60
- // verification: v,
61
- // requestBody: b,
62
- // }
63
- //
64
- // accountID, _ := utils.HashString(v.PublicKey)
65
- // account := CreatePaidAccountForTest(t, accountID)
66
- //
67
- // account.StorageLimit = models.StorageLimitType(1024)
68
- // account.MonthsInSubscription = 13
69
- // models.DB.Save(&account)
70
- //
71
- // w := httpPostRequestHelperForTest(t, AccountRenewInvoicePath, getInvoiceReq)
72
- // // Check to see if the response was what you expected
73
- // assert.Equal(t, http.StatusForbidden, w.Code)
74
- // assert.Contains(t, w.Body.String(), `account has too much time left to renew`)
75
- //}
50
+ func Test_GetAccountRenewInvoiceHandler_ReturnsErrorIfExpirationDateTooFarInFuture (t * testing.T ) {
51
+ models .DeleteAccountsForTest (t )
52
+ models .DeleteRenewalsForTest (t )
53
+
54
+ getInvoiceObj := getRenewalAccountInvoiceObject {}
55
+
56
+ v , b , _ := returnValidVerificationAndRequestBodyWithRandomPrivateKey (t , getInvoiceObj )
57
+
58
+ getInvoiceReq := getRenewalAccountInvoiceReq {
59
+ verification : v ,
60
+ requestBody : b ,
61
+ }
62
+
63
+ accountID , _ := utils .HashString (v .PublicKey )
64
+ account := CreatePaidAccountForTest (t , accountID )
65
+
66
+ account .StorageLimit = models .StorageLimitType (1024 )
67
+ account .MonthsInSubscription = 13
68
+ models .DB .Save (& account )
69
+
70
+ w := httpPostRequestHelperForTest (t , AccountRenewInvoicePath , getInvoiceReq )
71
+ // Check to see if the response was what you expected
72
+ assert .Equal (t , http .StatusForbidden , w .Code )
73
+ assert .Contains (t , w .Body .String (), `account has too much time left to renew` )
74
+ }
76
75
77
76
func Test_CheckRenewalStatusHandler_Returns_Status_OPQ_Renew_Success (t * testing.T ) {
78
77
models .DeleteAccountsForTest (t )
@@ -211,7 +210,6 @@ func returnRenewalForTest(t *testing.T, account models.Account) models.Renewal {
211
210
DurationInMonths : models .DefaultMonthsPerSubscription ,
212
211
PaymentStatus : models .InitialPaymentInProgress ,
213
212
OpqCost : renewalCostInOPQ ,
214
- UsdCost : utils .Env .Plans [int (account .StorageLimit )].CostInUSD ,
215
213
EthAddress : ethAddress .String (),
216
214
EthPrivateKey : hex .EncodeToString (utils .Encrypt (utils .Env .EncryptionKey , privateKey , account .AccountID )),
217
215
}
0 commit comments