<commit_before>require 'riot'
require 'whatcd'

username = ENV['WHATCD_USERNAME']
password = ENV['<PASSWORD>']

context WhatCD do 
	setup { WhatCD }

	asserts('includes HTTParty methods') { topic }.kind_of? HTTParty

	context 'Correct credentials' do
		hookup { WhatCD::authenticate username, password }

		asserts('is authenticated') { topic::authenticated? }
		asserts('requests with parameters') { 
			topic::User(id: 28747)
		}.kind_of Hash
		asserts('requests without paramters') { topic::Index }.kind_of Hash
		asserts('raises exceptions') { topic::Xxx }.raises WhatCD::APIError
	end

	context 'Incorrect credentials' do
		asserts('raises AuthError') {
			topic::authenticate '.', '..'
		}.raises WhatCD::AuthError
		asserts('raises AuthError') {
			topic::User(id: 28747)
		}.raises WhatCD::AuthError
	end
end<commit_msg>Readability<commit_after>require 'riot'
require 'whatcd'

username = ENV['WHATCD_USERNAME']
password = ENV['<PASSWORD>']

context WhatCD do 
	setup { WhatCD }

	asserts('includes HTTParty methods') { topic }.kind_of? HTTParty

	context 'Correct credentials' do
		hookup { topic::authenticate username, password }

		asserts('is authenticated') { topic::authenticated? }
		asserts('requests with parameters') {  topic::User(id: 28747) }.kind_of Hash
		asserts('requests without paramters') { topic::Index }.kind_of Hash
		asserts('raises exceptions') { topic::Xxx }.raises WhatCD::APIError
	end

	context 'Incorrect credentials' do
		hookup { topic::cookies {} }
		
		asserts('raises AuthError') { topic::authenticate '.', '..' }.raises WhatCD::AuthError
		asserts('raises AuthError') { topic::User(id: 28747) }.raises WhatCD::AuthError
	end
end
{'fraction_non_alphanumeric': 0.1375598086124402, 'fraction_numerical': 0.011961722488038277, 'mean_word_length': 5.385496183206107, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '7088352', 'n_tokens_mistral': 606, 'n_tokens_neox': 538, 'n_words': 133}