ios - Unit testing secret keys -
i using cocoapods-keys , trying test if method returns valid url secret api key.
test suite looks this:
it(@"should return valid url api", ^{ nsurl *url = [apiroutes apiurlwithpath:path parameters:nil]; expect([url absolutestring]).to.equal([nsstring stringwithformat:@"http://www.api.com/api/v2/places?api_key=my_api_key"]); });
but real method returning valid api key hash (e.g. 8s97f89asf89asf987saf) , test fails. how can test this? should create fake implementation of class in test file?
the way go mock url , api key apiroutes holds , test expected complete mock url. way test logic , not specific value of url.
Comments
Post a Comment