Files
Dalan/spec/api/v2/identity/general_spec.rb
2026-08-13 19:56:46 +03:30

42 lines
1.5 KiB
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe API::V2::Identity::General do
describe 'GET /api/v2/identity/time' do
it 'returns a server status' do
get '/api/v2/identity/ping'
expect_status_to_eq(200)
expect(json_body[:ping]).to eq('pong')
end
end
describe 'GET /api/v2/identity/time' do
it 'returns a current UNIX time' do
get '/api/v2/identity/time'
expect_status_to_eq(200)
expect(json_body[:time].to_i).to be <= Time.now.to_i
end
end
describe 'GET /api/v2/identity/configs' do
it 'returns some of the configurations' do
get '/api/v2/identity/configs'
expect_status_to_eq(200)
expect(json_body[:session_expire_time]).to eq(Barong::App.config.session_expire_time)
expect(json_body[:captcha_type]).to eq(Barong::App.config.captcha)
expect(json_body[:phone_verification_type]).to eq(Barong::App.config.phone_verification)
end
it 'returns all of the configurations with defaults' do
get '/api/v2/identity/configs'
expect_status_to_eq(200)
expect(json_body[:session_expire_time]).to eq(Barong::App.config.session_expire_time)
expect(json_body[:captcha_type]).to eq(Barong::App.config.captcha)
expect(json_body[:phone_verification_type]).to eq(Barong::App.config.phone_verification)
expect(json_body[:password_min_entropy]).to eq(Barong::App.config.password_min_entropy)
expect(json_body[:password_regexp]).to eq(Barong::App.config.password_regexp.to_s)
end
end
end