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

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -