Given an encoded (base64) JWT (access_token).
For example, see this sample OAuth2 response generated by JBoss APIMan/Keycloak
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Date: Tue, 25 Aug 2015 19:25:12 GMT
| require 'spec_helper' | |
| describe Api::V1::ClassificationsController, type: :controller do | |
| let!(:workflow) { create(:workflow_with_subjects) } | |
| let!(:set_member_subject) { workflow.subject_sets.first.set_member_subjects.first } | |
| let!(:user) { create(:user, cellect_hosts: { workflow.id.to_s => 'http://example.com' }) } | |
| let(:mocked_cellect) do | |
| cellect_connection = instance_double(Cellect::Client::Connection) | |
| expect(Cellect::Client).to receive(:connection).and_return(cellect_connection) | |
| cellect_connection |
| describe '#login' do | |
| it 'should validate presence' do | |
| expect{ User.create!(name: 't', password: 'password1', email: 'test@example.com') }.to raise_error | |
| end | |
| it 'should validate uniqueness' do | |
| expect{ User.create!(name: 't', login: 't', password: 'password1', email: 'test@example.com') }.to_not raise_error | |
| expect{ User.create!(name: 't', login: 't', password: 'password1', email: 'test2@example.com') }.to raise_error | |
| expect{ User.create!(name: 'T', login: 'T', password: 'password1', email: 'test3@example.com') }.to raise_error | |
| end |
| def post_link_relation(resource, constraint) | |
| post "/links/:link_relation", | |
| to: "#{resource}#update_links", | |
| constraints: { link_relation: constraint }, | |
| format: false | |
| end | |
| def delete_link_relation(resource, constraint) | |
| delete "/links/:link_relation/:link_ids", | |
| to: "#{resource}#destroy_links", |
| require 'benchmark' | |
| num = 1000000 | |
| uss = [] | |
| up_to_num = (1..num).to_a | |
| repeat = 100 | |
| num_class_subject_ids = 5 | |
| Benchmark.bm do |x| | |
| #full set intersection | |
| x.report { repeat.times do |num| ; (up_to_num & [num]).empty? ; end } |
| # IN PANOPTES | |
| # link the legacy_zoo_id (old zoo home) to the new panoptes project id | |
| migrated_ps = Project.where(migrated: true) | |
| migrated_ps.map { |p| "#{p.name} - #{p.configuration["zoo_home_project_id"]} - #{p.id}" } | |
| #=> ["penguin_watch - 35 - 55", "chimp_&_see - 41 - 60", "moon_zoo - 2 - 22", "galaxy_zoo - 1 - 21", "stardate_m83 - 29 - 49", "plankton_portal - 26 - 46", "galaxy_zoo_mergers - 4 - 24", "cyclone_center - 16 - 36", "chicago_wildlife_watch - 37 - 57", "microplants - 24 - 44", "science_gossip - 38 - 58", "whale_fm - 12 - 32", "bat_detective - 17 - 37", "asteroid_zoo - 33 - 53", "operation_war_diary - 28 - 48", "snapshot_serengeti - 20 - 40", "solar_stormwatch - 3 - 23", "ancient_lives - 10 - 30", "old_weather - 8 - 28", "galaxy_zoo_supernova - 5 - 25", "radio_galaxy_zoo - 27 - 47", "milky_way_project - 7 - 27", "worm_watch_lab - 25 - 45", "notes_from_nature - 22 - 42", "disk_detective - 30 - 50", "condor_watch - 32 - 52", "orchid_observers - 40 - 59", "ice_hunters - 9 - 29", "andr |
| SELECT bl.pid AS blocked_pid, | |
| a.usename AS blocked_user, | |
| ka.query AS current_statement_in_blocking_process, | |
| now() - ka.query_start AS blocking_duration, | |
| kl.pid AS blocking_pid, | |
| ka.usename AS blocking_user, | |
| a.query AS blocked_statement, | |
| now() - a.query_start AS blocked_duration | |
| FROM pg_catalog.pg_locks bl | |
| JOIN pg_catalog.pg_stat_activity a ON a.pid = bl.pid |
| SELECT | |
| relid::regclass AS table, | |
| indexrelid::regclass AS index, | |
| pg_size_pretty(pg_relation_size(indexrelid::regclass)) AS index_size, | |
| idx_tup_read, | |
| idx_tup_fetch, | |
| idx_scan | |
| FROM | |
| pg_stat_user_indexes | |
| JOIN pg_index USING (indexrelid) |
| diff --git a/spec/workers/concerns/dump_mailer_worker_spec.rb b/spec/workers/concerns/dump_mailer_worker_spec.rb | |
| index e8e14c1..1e51277 100644 | |
| --- a/spec/workers/concerns/dump_mailer_worker_spec.rb | |
| +++ b/spec/workers/concerns/dump_mailer_worker_spec.rb | |
| @@ -1,8 +1,10 @@ | |
| require 'spec_helper' | |
| describe DumpMailerWorker do | |
| - let(:resource) { double(id: 1) } | |
| - |
Given an encoded (base64) JWT (access_token).
For example, see this sample OAuth2 response generated by JBoss APIMan/Keycloak
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Date: Tue, 25 Aug 2015 19:25:12 GMT
| #!/usr/bin/env ruby | |
| if `git diff HEAD spec` =~ /^\+.*,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/ | |
| puts "\e[31mPlease focus and remove your :focus tags before committing :)" | |
| exit 1 | |
| end |