Module: Etna::Spec::Auth

Defined in:
lib/etna/spec/auth.rb

Constant Summary collapse

AUTH_USERS =
{
  superuser: {
    email: '[email protected]', name: 'Zeus', perm: 'A:administration'
  },
  admin: {
    email: '[email protected]', name: 'Hera', perm: 'a:labors'
  },
  editor: {
    email: '[email protected]', name: 'Eurystheus', perm: 'E:labors'
  },
  restricted_editor: {
    email: '[email protected]', name: 'Copreus', perm: 'e:labors'
  },
  viewer: {
    email: '[email protected]', name: 'Hercules', perm: 'v:labors'
  },
  non_user: {
    email: '[email protected]', name: 'Nessus', perm: ''
  },
  guest: {
    email: '[email protected]', name: 'Sinon', perm: 'g:labors'
  }
}

Instance Method Summary collapse

Instance Method Details

#auth_header(user_type) ⇒ Object



27
28
29
# File 'lib/etna/spec/auth.rb', line 27

def auth_header(user_type)
  header(*Etna::TestAuth.token_header(AUTH_USERS[user_type]))
end

#below_admin_rolesObject



31
32
33
# File 'lib/etna/spec/auth.rb', line 31

def below_admin_roles
  [:editor, :viewer, :guest]
end

#below_editor_rolesObject



35
36
37
# File 'lib/etna/spec/auth.rb', line 35

def below_editor_roles
  [:viewer, :guest]
end

#stub_janus_refreshObject



39
40
41
42
43
44
45
# File 'lib/etna/spec/auth.rb', line 39

def stub_janus_refresh
  stub_request(:post, /\/api\/tokens\/generate/)
  .to_return({
    status: 200,
    body: ""
  })
end