package org.kohsuke.github;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import org.junit.Test;
public class Github2faTest  extends AbstractGitHubWireMockTest {

	@Test
	public void test2faToken() throws IOException {
		assertFalse("Test only valid when not proxying", mockGitHub.isUseProxy());

		List<String> asList = Arrays.asList("repo", "gist", "write:packages", "read:packages", "delete:packages",
				"user", "delete_repo");
		String nameOfToken = "Test2faTokenCreate";//+timestamp;// use time stamp to ensure the token creations do not collide with older tokens

		GHAuthorization token=gitHub.createToken(
		        asList, 
		        nameOfToken,
		        "this is a test token created by a unit test", () -> {
		        	String data = "111878";
		        	// TO UPDATE run this in debugger mode, put a breakpoint here, and enter the OTP you get into the value of Data
		            return data; 
		        });
		assert token!=null;
		
		String p = token.getToken();
		
		assert p!=null;
	}
}

@@ -970,16 +970,127 @@
 !=null;%0A
+%09%09for(int i=0;i%3CasList.size();i++) %7B%0A%09%09%09assertTrue(token.getScopes().get(i).contentEquals(asList.get(i)));%0A%09%09%7D%0A
 %09%09%0A%09%09Str

add testing of scopes in assigned token