mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 12:17:30 +02:00
Changed tests
This commit is contained in:
parent
64cb2c35f3
commit
68ff1c1e64
2 changed files with 4 additions and 3 deletions
|
@ -6,7 +6,7 @@ module Repp
|
||||||
desc 'check login user and return data'
|
desc 'check login user and return data'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@login = current_user
|
@login = current_user.registrar
|
||||||
|
|
||||||
# rubocop:disable Style/AndOr
|
# rubocop:disable Style/AndOr
|
||||||
render_success(data: nil) and return unless @login
|
render_success(data: nil) and return unless @login
|
||||||
|
|
|
@ -3,6 +3,7 @@ require 'test_helper'
|
||||||
class ReppV1LoginTest < ActionDispatch::IntegrationTest
|
class ReppV1LoginTest < ActionDispatch::IntegrationTest
|
||||||
def setup
|
def setup
|
||||||
@user = users(:api_bestnames)
|
@user = users(:api_bestnames)
|
||||||
|
@registrar = @user.registrar
|
||||||
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}")
|
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}")
|
||||||
token = "Basic #{token}"
|
token = "Basic #{token}"
|
||||||
|
|
||||||
|
@ -14,8 +15,8 @@ class ReppV1LoginTest < ActionDispatch::IntegrationTest
|
||||||
json = JSON.parse(response.body, symbolize_names: true)
|
json = JSON.parse(response.body, symbolize_names: true)
|
||||||
|
|
||||||
assert_response :ok
|
assert_response :ok
|
||||||
assert_equal json[:data][:username], @user.username
|
assert_equal json[:data][:email], @registrar.email
|
||||||
assert_equal json[:data][:identity_code], @user.identity_code
|
assert_equal json[:data][:id], @registrar.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_login
|
def test_invalid_login
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue