Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i write test case for function fetch_github_info in Offchain worker example #459

Open
CocDap opened this issue Aug 17, 2021 · 0 comments

Comments

@CocDap
Copy link

CocDap commented Aug 17, 2021

Hello, I try to write a test case for checking function fetch_github_info in offchain worker. But it failed.

#[test]                                                                                                              
fn fetch_submit_info_works() {                                                                                       
      let (mut t, _, _) = ExternalityBuilder::build();                                                                 
      t.execute_with(|| {                                                                                              
            System::set_block_number(4);
            assert_ok!(OcwDemo::fetch_github_info())
});
}

It catch Error in line 405 that Response doesnt response from API in function fn fetch_from_remote()
image
image

But when I check in Polkadot.js.org it works and has fetched data from API
Can you have any idea to fix this?
I updated, but it failed because data stores in offchain worker has None
image

Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@CocDap and others