Commit 697a88548174428a15f91ece4150994e4e488f6f
1 parent
a61f2fc8
update tests
Showing
7 changed files
with
27 additions
and
9 deletions
Show diff stats
lib/syspro/get_logon_profile.rb
lib/syspro/get_version.rb
lib/syspro/logon.rb
lib/syspro/syspro_client.rb
... | ... | @@ -2,19 +2,19 @@ module Syspro |
2 | 2 | class SysproClient |
3 | 3 | attr_accessor :conn, :api_base |
4 | 4 | |
5 | + @verify_ssl_warned = false | |
6 | + | |
5 | 7 | def initialize(conn = nil) |
6 | 8 | self.conn = conn || self.class.default_conn |
7 | 9 | @system_profiler = SystemProfiler.new |
8 | 10 | end |
9 | 11 | |
10 | 12 | def logon(username, password, company_id, company_password) |
11 | - logon_getter = Syspro::ApiOperations::Logon.new | |
12 | - logon_getter.logon(username, password, company_id, company_password) | |
13 | + Syspro::Logon.logon(username, password, company_id, company_password) | |
13 | 14 | end |
14 | 15 | |
15 | 16 | def get_syspro_version |
16 | - version_getter = Syspro::ApiOperations::GetVersion.new | |
17 | - version_getter.get_version | |
17 | + Syspro::GetVersion.get_version | |
18 | 18 | end |
19 | 19 | |
20 | 20 | def self.active_client | ... | ... |
test/client_test.rb
... | ... | @@ -3,6 +3,6 @@ require "test_helper" |
3 | 3 | class SysproClientTest < Minitest::Test |
4 | 4 | def test_get_syspro_version |
5 | 5 | client = ::Syspro::SysproClient.new |
6 | - assert_match /(\d+\.)?(\d+\.)?(\d+\.)?(\d+)/, client.get_syspro_version.version | |
6 | + assert_match (/(\d+\.)?(\d+\.)?(\d+\.)?(\d+)/), client.get_syspro_version.version | |
7 | 7 | end |
8 | 8 | end | ... | ... |
1 | +require "test_helper" | |
2 | + | |
3 | +class LogoffTest < Minitest::Test | |
4 | + def test_successful_logoff | |
5 | + username = "wland" | |
6 | + password = "piperita2016" | |
7 | + company = "L" | |
8 | + company_password = "" | |
9 | + | |
10 | + uid = Syspro::Logon.logon(username, password, company, company_password) | |
11 | + assert_equal true, Syspro::Logoff.logoff(uid.guid) | |
12 | + end | |
13 | + | |
14 | + def test_logoff_error | |
15 | + assert_kind_of String, Syspro::Logoff.logoff('1BB5B3050954BB459A5D034DB5CC386980') | |
16 | + end | |
17 | +end | |
18 | + | ... | ... |
test/logon_test.rb
... | ... | @@ -8,7 +8,7 @@ class LogonTest < Minitest::Test |
8 | 8 | company_password = "" |
9 | 9 | client = ::Syspro::SysproClient.new |
10 | 10 | |
11 | - assert_match /([A-Z0-9]{33})\w/, client.logon(username, password, company, company_password).guid | |
11 | + assert_match (/([A-Z0-9]{33})\w/), client.logon(username, password, company, company_password).guid | |
12 | 12 | end |
13 | 13 | end |
14 | 14 | ... | ... |