Blame view

test/logon_test.rb 750 Bytes
dc8aa5b6   Joe Weakley   Rubocop corrections
1
2
3
  # frozen_string_literal: true
  
  require 'test_helper'
49716587   Isaac Lewis   refactor object s...
4
5
  
  class LogonTest < Minitest::Test
dc8aa5b6   Joe Weakley   Rubocop corrections
6
    extend Minitest::Spec::DSL
f65bf747   Joe Weakley   Added and configu...
7
8
    before { VCR.insert_cassette name }
    after { VCR.eject_cassette }
dc8aa5b6   Joe Weakley   Rubocop corrections
9
10
11
12
13
  
    let(:username) { 'wland' }
    let(:password) { 'piperita2016' }
    let(:company) { 'L' }
    let(:company_password) { '' }
49716587   Isaac Lewis   refactor object s...
14
  
dc8aa5b6   Joe Weakley   Rubocop corrections
15
16
17
18
19
20
21
22
23
24
    def test_logon
      assert_match(
        /([A-Z0-9]{33})\w/,
        ::Syspro::SysproClient.new.logon(
          username,
          password,
          company,
          company_password
        ).guid
      )
49716587   Isaac Lewis   refactor object s...
25
    end
81bf56e4   Isaac Lewis   logon error handling
26
27
28
29
30
31
32
33
34
35
36
  
    def test_logon_error
      assert_raises(::Syspro::AuthenticationError) {
        logon_result = ::Syspro::SysproClient.new.logon(
          username,
          'bad_password',
          company,
          company_password
        )
      }
    end
49716587   Isaac Lewis   refactor object s...
37
  end