github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/token_pause_transaction_e2e_test.go (about) 1 //go:build all || e2e 2 // +build all e2e 3 4 package hedera 5 6 /*- 7 * 8 * Hedera Go SDK 9 * 10 * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC 11 * 12 * Licensed under the Apache License, Version 2.0 (the "License"); 13 * you may not use this file except in compliance with the License. 14 * You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, software 19 * distributed under the License is distributed on an "AS IS" BASIS, 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 * See the License for the specific language governing permissions and 22 * limitations under the License. 23 * 24 */ 25 26 import ( 27 "testing" 28 29 "github.com/stretchr/testify/require" 30 ) 31 32 func TestIntegrationTokenPauseTransactionCanExecute(t *testing.T) { 33 t.Parallel() 34 env := NewIntegrationTestEnv(t) 35 36 tokenID, err := createFungibleToken(&env) 37 38 info, err := NewTokenInfoQuery(). 39 SetTokenID(tokenID). 40 Execute(env.Client) 41 42 require.NotNil(t, info.PauseStatus) 43 require.False(t, *info.PauseStatus) 44 45 resp, err := NewTokenPauseTransaction(). 46 SetTokenID(tokenID). 47 Execute(env.Client) 48 require.NoError(t, err) 49 50 _, err = resp.SetValidateStatus(true).GetReceipt(env.Client) 51 require.NoError(t, err) 52 53 info, err = NewTokenInfoQuery(). 54 SetTokenID(tokenID). 55 SetNodeAccountIDs([]AccountID{resp.NodeID}). 56 Execute(env.Client) 57 require.NoError(t, err) 58 59 require.NotNil(t, info.PauseStatus) 60 require.True(t, *info.PauseStatus) 61 62 //Unpause token to avoid error in CloseIntegrationTestEnv 63 resp, err = NewTokenUnpauseTransaction(). 64 SetNodeAccountIDs([]AccountID{resp.NodeID}). 65 SetTokenID(tokenID). 66 Execute(env.Client) 67 68 require.NoError(t, err) 69 70 err = CloseIntegrationTestEnv(env, &tokenID) 71 require.NoError(t, err) 72 }