<commit_before>require './test/test_base.rb'

require 'faraday'
require 'multi_json'
require 'oauth2'

class MediumSdkSetupOAuthTest < Test::Unit::TestCase
  def setup
    @string = 'deadbeef'
    @redirect_uri = 'https://example.com/callback'
    @sdk = MediumSdk.new client_id: 'dead', client_secret: 'beef', redirect_uri: @redirect_uri
  end

  def test_main
    assert_equal 'dead', @sdk.connection.client_id
    assert_equal @redirect_uri, @sdk.connection.oauth_redirect_uri
    assert_equal 'https://api.medium.com/v1', @sdk.connection.api_version_uri
  end

  def token_hash
    token = {
      'access_token' => @string
    }
    @sdk.connection.set_token token
    token2 = @sdk.connection.token.to_hash
    assert_equal @string, token2[:access_token]
  end

  def token_string_json
    token = {
      'access_token' => @string + @string
    }
    token2 = MultiJson.encode token
    @sdk.connection.set_token token2
    token3 = @sdk.connection.token.to_hash
    assert_equal (@string + @string), token3[:access_token]  
  end

  def token_string
    @sdk.connection.set_token @string
    token = @sdk.connection.token.to_hash
    assert_equal @string, token[:access_token]  
  end
end<commit_msg>update tests<commit_after>require './test/test_base.rb'

require 'faraday'
require 'multi_json'
require 'oauth2'

class MediumSdkSetupOAuthTest < Test::Unit::TestCase
  def setup
    @string = 'deadbeef'
    @redirect_uri = 'https://example.com/callback'
    @sdk = MediumSdk.new client_id: 'dead', client_secret: 'beef', redirect_uri: @redirect_uri
  end

  def test_main
    assert_equal 'dead', @sdk.connection.client_id
    assert_equal @redirect_uri, @sdk.connection.oauth_redirect_uri
    assert_equal 'https://api.medium.com/v1', @sdk.connection.api_version_uri

    token = {
      'access_token' => @<PASSWORD>
    }
    @sdk.connection.set_token token
    token2 = @sdk.connection.token.to_hash
    assert_equal @string, token2[:access_token]

    token = {
      'access_token' => @<PASSWORD> + @<PASSWORD>
    }
    token2 = MultiJson.encode token
    @sdk.connection.set_token token2
    token3 = @sdk.connection.token.to_hash
    assert_equal (@string + @string), token3[:access_token]  

    @sdk.connection.set_token @string
    token = @sdk.connection.token.to_hash
    assert_equal @string, token[:access_token]  
  end
end
{'fraction_non_alphanumeric': 0.11579395487441464, 'fraction_numerical': 0.006811409110259685, 'mean_word_length': 3.786150712830957, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5867473', 'n_tokens_mistral': 800, 'n_tokens_neox': 785, 'n_words': 151}