Do i require .aws credentials file for passing the test case of aws cloudwatch api, i have mock by using gomock package

i had created a createSession() function for creating aws session, which is returning session and error, passing this created session into metric function, I also created function metric(session, metrics name, …) error{} and passing all parameters(session, metrics name, …) into this function and this function is creating client using input session, and thus calling putmetric api.
I need to mock this function and i did this by gomock, but i have one doubt that when i am writing the unit test case fo this mertic() func, i am passing the original session which i have created from createSession() into mock one, i define the except of metric(…).Return(nil)
i aslo called the original function with real session value metric(session, …) here in test file and checking for error (if metrics is sent successfully over cloudwatch then it will return nil error),
and finally checking with assert.Equal(t, err, mock.metric(session, …))
This is working fine in my system as my system has .aws credentials file so it is able to create session and check for the test case, it is passing.
as my test case is dependent on .aws credentials file,
So my question is that is this correct way for mocking aws cloudwatch api.
should the program be dependent on .aws credentils file to pass the test case?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.