Example #1
0
    public void testGetAccessTokenFromIntent_shouldReturnToken() {
        var intent = new Intent();
        var token = new NestToken("token", 123);
        intent.putExtra("access_token_key", token);

        var tokenFromIntent = new Oauth2FlowHandler(new OkHttpClient()).getAccessTokenFromIntent(intent);
        Assert.IsNotNull(tokenFromIntent);
        Assert.AreEqual(token, tokenFromIntent);
    }
Example #2
0
    public void testSetGetConfig_shouldWriteReadConfig() {
        var handler = new Oauth2FlowHandler(new OkHttpClient());

        String clientId = "clientId";
        String clientSecret = "clientSecret";
        String redirectUrl = "redirectUrl";
        handler.setConfig(clientId, clientSecret, redirectUrl);

        Assert.AreEqual(handler.Config.ClientID, clientId);
        Assert.AreEqual(handler.Config.ClientSecret, clientSecret);
        Assert.AreEqual(handler.Config.RedirectURL, redirectUrl);

        handler.clearConfig();

        Assert.IsNull(handler.Config);
    }