ruby-jss 2.0.0a10 → 2.0.0a11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README-2.0.0.md +9 -1
- data/lib/jamf/api/classic/api_objects/criteriable.rb +1 -1
- data/lib/jamf/api/classic/base_classes/advanced_search.rb +1 -1
- data/lib/jamf/api/connection.rb +1 -1
- data/lib/jamf/api/jamf_pro/base_classes/oapi_object.rb +6 -0
- data/lib/jamf/api/jamf_pro/mixins/prestage.rb +17 -7
- data/lib/jamf/constants.rb +1 -1
- data/lib/jamf/version.rb +1 -1
- data/lib/zeitwerk_config.rb +4 -3
- data/test/lib/jamf_test/APITest.rb +33 -7
- data/test/lib/jamf_test/advanced_search.rb +40 -0
- data/test/lib/jamf_test/collection_tests.rb +4 -6
- data/test/lib/jamf_test/prestage_tests.rb +135 -0
- data/test/lib/jamf_test.rb +7 -1
- data/test/tests/advanced_computer_search.rb +36 -0
- data/test/tests/advanced_mobile_device_search.rb +36 -0
- data/test/tests/advanced_user_search.rb +36 -0
- data/test/tests/computer_prestage.rb +36 -0
- data/test/tests/inventory_preload_record.rb +2 -2
- data/test/tests/mobile_device_prestage.rb +37 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89a063540145b18ab23771f87ad6eb8db80c154e911138b75a7a233117fb6dc6
|
4
|
+
data.tar.gz: 139bc4655da8a6a1e4bed21add476f6bfaa844dbda4fb0e477fdcee45079cc9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33d23b52e0f0bb2f42a4a606ae34288b4b7ceb35e3d051ccb1281456709cdee7d4bcaea26681f30126239e30bde8de55bc550fe021d2e59a9cd0f05fdeb40d65
|
7
|
+
data.tar.gz: b8b8c46c351833c47493ad2512349b952522d2916bcac4b0143a0c49aa140187635be582ad5971da0a63e599fbd263900eecb01bce24b88da6f88a8457ea82fc
|
data/README-2.0.0.md
CHANGED
@@ -35,6 +35,7 @@ These changes have been in mind for some time, but the ability (soon to be requi
|
|
35
35
|
- [Jamf::Connection instance methods `#next_refresh`, `#secs_to_refresh`, & `#time_to_refresh`](#jamfconnection-instance-methods-next_refresh-secs_to_refresh---time_to_refresh)
|
36
36
|
- [Cross-object validation in setters](#cross-object-validation-in-setters)
|
37
37
|
- [.fetch :random](#fetch-random)
|
38
|
+
- [Documentation](#documentation)
|
38
39
|
- [How to install for testing](#how-to-install-for-testing)
|
39
40
|
- [Contact](#contact)
|
40
41
|
|
@@ -42,7 +43,9 @@ These changes have been in mind for some time, but the ability (soon to be requi
|
|
42
43
|
|
43
44
|
## Requirements
|
44
45
|
|
45
|
-
ruby-jss 2.0
|
46
|
+
ruby-jss 2.0 requires ruby 2.6.3 or higher, and a Jamf Pro server running version 10.35 or higher.
|
47
|
+
|
48
|
+
This means it will work with the OS-supplied /usr/bin/ruby in macOS 10.15 Catalina and above, until Apple removes ruby from the OS.
|
46
49
|
|
47
50
|
## High level changes
|
48
51
|
|
@@ -300,6 +303,11 @@ The last point is very important. Right now, in order to be able to manipulate
|
|
300
303
|
|
301
304
|
You can still fetch random objects from a collection, but use `.fetch random: true`. The older `.fetch :random` is deprecated and will be removed.
|
302
305
|
|
306
|
+
## Documentation
|
307
|
+
|
308
|
+
The YARD documentation for v2.0.0 is available before release in the [github.io site for ruby-jss](http://pixaranimationstudios.github.io/ruby-jss/docs/v2.x/index.html).
|
309
|
+
|
310
|
+
All the documentation for ruby-jss is in need of updating, from the top-level README to the auto-generated YARD docs. If you have questions that aren't answered there, please reach out (see Contact, below)
|
303
311
|
|
304
312
|
## How to install for testing
|
305
313
|
|
@@ -153,7 +153,7 @@ module Jamf
|
|
153
153
|
#
|
154
154
|
def parse_criteria
|
155
155
|
@criteria = Jamf::Criteriable::Criteria.new
|
156
|
-
@criteria.criteria = @init_data[:criteria].map { |c| Jamf::Criteriable::Criterion.new c } if @init_data[:criteria]
|
156
|
+
@criteria.criteria = @init_data[:criteria].map { |c| Jamf::Criteriable::Criterion.new **c } if @init_data[:criteria]
|
157
157
|
|
158
158
|
@criteria.container = self
|
159
159
|
end
|
data/lib/jamf/api/connection.rb
CHANGED
@@ -60,6 +60,12 @@ module Jamf
|
|
60
60
|
self::OAPI_PROPERTIES.select { |_attr, deets| deets[:required] }.keys
|
61
61
|
end
|
62
62
|
|
63
|
+
# have we already parsed our OAPI_PROPERTIES? If so,
|
64
|
+
# we shoudn't do it again, an this can be used to check
|
65
|
+
def self.oapi_properties_parsed?
|
66
|
+
@oapi_properties_parsed
|
67
|
+
end
|
68
|
+
|
63
69
|
# create getters and setters for subclasses of APIObject
|
64
70
|
# based on their OAPI_PROPERTIES Hash.
|
65
71
|
#
|
@@ -139,6 +139,11 @@ module Jamf
|
|
139
139
|
# Is the given serialNumber assigned to any prestage, or to the
|
140
140
|
# given prestage if a prestage is specified?
|
141
141
|
#
|
142
|
+
# This uses .serials_by_prestage_id, the class-level scope path which
|
143
|
+
# gets a hash of all assigned SNS => the id of the prestage they are
|
144
|
+
# assigned to. The instance#assigned? method uses a different path
|
145
|
+
# which returnds more data in an OAPI object.
|
146
|
+
#
|
142
147
|
# NOTE: If a serial number isn't assigned to any prestage, it may really be
|
143
148
|
# unassigned or it may not exist in your ADE. To see if a SN exists in one
|
144
149
|
# of your Device Enrollment instances, use Jamf::DeviceEnrollment.include?
|
@@ -269,6 +274,8 @@ module Jamf
|
|
269
274
|
|
270
275
|
# The scope data for this prestage
|
271
276
|
#
|
277
|
+
# TODO: retain this caching?
|
278
|
+
#
|
272
279
|
# @param refresh[Boolean] reload fromthe API?
|
273
280
|
#
|
274
281
|
# @return [PrestageScope]
|
@@ -278,6 +285,8 @@ module Jamf
|
|
278
285
|
return @scope if @scope
|
279
286
|
|
280
287
|
@scope = INSTANCE_SCOPE_OBJECT.new @cnx.get(scope_path)
|
288
|
+
# TODO: is this the best way to deal with fetching a scope that
|
289
|
+
# is more updated than the rest of the object?
|
281
290
|
unless @scope.versionLock == @versionLock
|
282
291
|
raise Jamf::VersionLockError, "The #{self.class} '#{name}' has been modified since it was fetched. Please refetch and try again"
|
283
292
|
end
|
@@ -286,12 +295,18 @@ module Jamf
|
|
286
295
|
end
|
287
296
|
|
288
297
|
# @return [Array<String>] the serialnumbers assigned to this prestage
|
289
|
-
def assigned_sns
|
290
|
-
|
298
|
+
def assigned_sns(refresh: false)
|
299
|
+
return @assigned_sns if @assigned_sns
|
300
|
+
|
301
|
+
@assigned_sns = nil if refresh
|
302
|
+
@assigned_sns = scope.assignments.map(&:serialNumber)
|
291
303
|
end
|
292
304
|
|
293
305
|
# Is this SN assigned to this prestage?
|
294
306
|
#
|
307
|
+
# This method uses the instance's scope object, from a different API
|
308
|
+
# path than the class-level .assigned? method.
|
309
|
+
#
|
295
310
|
# @param sn[String] the sn to look for
|
296
311
|
#
|
297
312
|
# @return [Boolean]
|
@@ -336,11 +351,6 @@ module Jamf
|
|
336
351
|
@scope_path ||= "#{get_path}/#{SCOPE_PATH}"
|
337
352
|
end
|
338
353
|
|
339
|
-
def scope
|
340
|
-
data = @cnx.jp_get(scope_path)
|
341
|
-
INSTANCE_SCOPE_OBJECT.new **data
|
342
|
-
end
|
343
|
-
|
344
354
|
end # class
|
345
355
|
|
346
356
|
end # module
|
data/lib/jamf/constants.rb
CHANGED
@@ -30,7 +30,7 @@ module Jamf
|
|
30
30
|
module Constants
|
31
31
|
|
32
32
|
# The minimum Ruby version needed for ruby-jss
|
33
|
-
MINIMUM_RUBY_VERSION = '2.
|
33
|
+
MINIMUM_RUBY_VERSION = '2.6.3'.freeze
|
34
34
|
|
35
35
|
# These are handy for testing values without making new arrays, strings, etc every time.
|
36
36
|
TRUE_FALSE = [true, false].freeze
|
data/lib/jamf/version.rb
CHANGED
data/lib/zeitwerk_config.rb
CHANGED
@@ -123,17 +123,18 @@ def setup_zeitwerk_loader(loader)
|
|
123
123
|
# Parse OAPI_PROPERTIES into getters and setters for subclasses of
|
124
124
|
# OAPIObject in the JPAPI.
|
125
125
|
# The class we just loaded must have this method and constant
|
126
|
-
# and the
|
126
|
+
# and the method must not have run already for the class or any superclass.
|
127
127
|
# This prevents running parse_oapi_properties again in subclasses that
|
128
128
|
# don't need to do that
|
129
|
-
if value.respond_to?(:
|
129
|
+
if value.respond_to?(:oapi_properties_parsed?) && \
|
130
130
|
defined?(value::OAPI_PROPERTIES) && \
|
131
|
-
|
131
|
+
!value.oapi_properties_parsed?
|
132
132
|
|
133
133
|
parsed = value.parse_oapi_properties
|
134
134
|
Jamf.load_msg "Parsed OAPI_PROPERTIES for #{value}" if parsed
|
135
135
|
end
|
136
136
|
|
137
|
+
|
137
138
|
# Generate the identifier list methods (.all_*) for subclasses of APIObject
|
138
139
|
# in the Classic API
|
139
140
|
if value.is_a?(Class) && value.superclass == Jamf::APIObject
|
@@ -41,25 +41,51 @@ module JamfTest
|
|
41
41
|
end
|
42
42
|
|
43
43
|
#####
|
44
|
-
def validate_hash(hash, has_key: nil, val_class: nil)
|
44
|
+
def validate_hash(hash, has_key: nil, class_for_has_key: nil, key_class: nil, val_class: nil)
|
45
45
|
raise 'Value is not a Hash' unless hash.is_a? Hash
|
46
|
-
return unless has_key
|
47
46
|
|
48
|
-
|
49
|
-
|
47
|
+
if hash.empty?
|
48
|
+
say 'WARNING: Hash is empty! This may be OK depending on your environment'
|
49
|
+
return
|
50
|
+
end
|
51
|
+
|
52
|
+
if has_key
|
53
|
+
raise "Hash does not have required key #{has_key}" unless hash.key?(has_key)
|
54
|
+
|
55
|
+
say "Hash has key '#{has_key}'"
|
56
|
+
if class_for_has_key
|
57
|
+
val = hash[has_key]
|
58
|
+
raise "Value '#{val}' for key '#{has_key}' is a #{val.class} not #{class_for_has_key}" unless val.is_a?(class_for_has_key)
|
59
|
+
|
60
|
+
say "Value '#{val}' for key '#{has_key}' is a #{class_for_has_key}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
if key_class
|
65
|
+
key = hash.keys.sample
|
50
66
|
|
51
|
-
|
67
|
+
raise "Hash key'#{key}' is a #{key.class} not #{key_class}" unless key.is_a?(key_class)
|
68
|
+
|
69
|
+
say "Hash keys are class: #{key_class}"
|
70
|
+
end
|
71
|
+
|
72
|
+
if val_class
|
73
|
+
val = hash.values.sample
|
74
|
+
raise "Hash value '#{val}' is a #{val.class} not #{val_class}" unless val.is_a?(val_class)
|
75
|
+
|
76
|
+
say "Hash value are class: #{val_class}"
|
77
|
+
end
|
52
78
|
end
|
53
79
|
|
54
80
|
#####
|
55
81
|
def validate_array(ary, item_class: nil)
|
56
82
|
raise 'Value is not an Array' unless ary.is_a? Array
|
57
|
-
return unless item_class
|
58
83
|
|
59
84
|
if ary.empty?
|
60
|
-
|
85
|
+
say 'WARNING: Array is empty! This may be OK depending on your environment'
|
61
86
|
return
|
62
87
|
end
|
88
|
+
return unless item_class
|
63
89
|
|
64
90
|
raise "Randomly chosen item from Array is not a #{item_class}" unless ary.sample.is_a? item_class
|
65
91
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
### Copyright 2022 Pixar
|
2
|
+
|
3
|
+
###
|
4
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
+
### with the following modification; you may not use this file except in
|
6
|
+
### compliance with the Apache License and the following modification to it:
|
7
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
+
###
|
9
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
10
|
+
### names, trademarks, service marks, or product names of the Licensor
|
11
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
12
|
+
### the License and to reproduce the content of the NOTICE file.
|
13
|
+
###
|
14
|
+
### You may obtain a copy of the Apache License at
|
15
|
+
###
|
16
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
###
|
18
|
+
### Unless required by applicable law or agreed to in writing, software
|
19
|
+
### distributed under the Apache License with the above modification is
|
20
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
+
### KIND, either express or implied. See the Apache License for the specific
|
22
|
+
### language governing permissions and limitations under the Apache License.
|
23
|
+
###
|
24
|
+
###
|
25
|
+
|
26
|
+
module JamfTest
|
27
|
+
|
28
|
+
module AdvancedSearchTests
|
29
|
+
|
30
|
+
include JamfTest::CollectionTests
|
31
|
+
|
32
|
+
# run the tests
|
33
|
+
def run_class_tests
|
34
|
+
run_collection_tests do_object_tests: false
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end # module
|
39
|
+
|
40
|
+
end # module JamfTest
|
@@ -93,11 +93,12 @@ module JamfTest
|
|
93
93
|
fetch_random
|
94
94
|
return unless do_object_tests
|
95
95
|
|
96
|
-
#
|
96
|
+
# The methods below are very basic and assume a simple object
|
97
97
|
# that can be created with only a 'name'.
|
98
98
|
#
|
99
99
|
# For anything more complex, they should be overridden in the classes that
|
100
100
|
# mixin this module, since the details will be very different
|
101
|
+
# See inventory_preload_record.rb for an example
|
101
102
|
|
102
103
|
create_new
|
103
104
|
add_data_to_new
|
@@ -128,8 +129,7 @@ module JamfTest
|
|
128
129
|
|
129
130
|
one_of_all = @cached_all.sample
|
130
131
|
|
131
|
-
validate_hash one_of_all, has_key: :id,
|
132
|
-
|
132
|
+
validate_hash one_of_all, has_key: :id, class_for_has_key: id_class
|
133
133
|
end
|
134
134
|
|
135
135
|
#################
|
@@ -140,8 +140,6 @@ module JamfTest
|
|
140
140
|
say "There are no #{collection_class} objects on the server, not testing sorted_all"
|
141
141
|
return
|
142
142
|
end
|
143
|
-
|
144
|
-
|
145
143
|
sorted_desc = collection_class.all sort: 'id:desc'
|
146
144
|
raise "#{collection_class}.all sort: 'id:desc' ; didn't work as expected" unless sorted_desc.first[:id].to_i >= sorted_desc.last[:id].to_i
|
147
145
|
|
@@ -182,7 +180,7 @@ module JamfTest
|
|
182
180
|
identifiers.each do |ident|
|
183
181
|
next if ident == :id
|
184
182
|
|
185
|
-
mth = ident.end_with?('s') ? "all_#{ident}es" : "all_#{ident}s"
|
183
|
+
mth = ident.to_s.end_with?('s') ? "all_#{ident}es" : "all_#{ident}s"
|
186
184
|
collection_class.send mth
|
187
185
|
say "Ran #{collection_class}.#{mth}"
|
188
186
|
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
### Copyright 2022 Pixar
|
2
|
+
|
3
|
+
###
|
4
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
+
### with the following modification; you may not use this file except in
|
6
|
+
### compliance with the Apache License and the following modification to it:
|
7
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
+
###
|
9
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
10
|
+
### names, trademarks, service marks, or product names of the Licensor
|
11
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
12
|
+
### the License and to reproduce the content of the NOTICE file.
|
13
|
+
###
|
14
|
+
### You may obtain a copy of the Apache License at
|
15
|
+
###
|
16
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
###
|
18
|
+
### Unless required by applicable law or agreed to in writing, software
|
19
|
+
### distributed under the Apache License with the above modification is
|
20
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
+
### KIND, either express or implied. See the Apache License for the specific
|
22
|
+
### language governing permissions and limitations under the Apache License.
|
23
|
+
###
|
24
|
+
###
|
25
|
+
|
26
|
+
module JamfTest
|
27
|
+
|
28
|
+
module PrestageTests
|
29
|
+
|
30
|
+
include JamfTest::CollectionTests
|
31
|
+
|
32
|
+
# run the tests
|
33
|
+
def run_class_tests
|
34
|
+
run_collection_tests do_object_tests: false
|
35
|
+
|
36
|
+
if @cached_all.empty?
|
37
|
+
say 'No ComputerPrestages defined, skipping remaining tests'
|
38
|
+
return
|
39
|
+
end
|
40
|
+
|
41
|
+
# class methods
|
42
|
+
fetch_default_prestage
|
43
|
+
all_serials_by_prestage_id
|
44
|
+
serials_for_prestage
|
45
|
+
|
46
|
+
unless @sampled_sn
|
47
|
+
say 'No serial numbers assigned to any prestage, cannot continue tests on this server.'
|
48
|
+
return
|
49
|
+
end
|
50
|
+
|
51
|
+
assigned_prestage_id
|
52
|
+
assigned_via_class
|
53
|
+
|
54
|
+
say 'NOTE: Not testing assign/unassign. Too much potential for havoc on prod. servers. Use IRB to test manually'
|
55
|
+
|
56
|
+
# instance methods
|
57
|
+
scope
|
58
|
+
assigned_via_scope
|
59
|
+
end
|
60
|
+
|
61
|
+
#########
|
62
|
+
def fetch_default_prestage
|
63
|
+
@default_computer_prestage = collection_class.default
|
64
|
+
say "Ran #{collection_class}.default to fetch the default Computer prestage"
|
65
|
+
end
|
66
|
+
|
67
|
+
#########
|
68
|
+
def all_serials_by_prestage_id
|
69
|
+
serials = collection_class.serials_by_prestage_id
|
70
|
+
say "Ran #{collection_class}.default to fetch the default Computer prestage"
|
71
|
+
validate_hash serials, key_class: String, val_class: String
|
72
|
+
@sampled_sn = serials.keys.sample
|
73
|
+
@sample_prestage_id = serials[@sampled_sn]
|
74
|
+
end
|
75
|
+
|
76
|
+
###########
|
77
|
+
def serials_for_prestage
|
78
|
+
collection_class.serials_for_prestage @default_computer_prestage.id
|
79
|
+
say "Ran #{collection_class}.serials_for_prestage '#{@default_computer_prestage.id}'"
|
80
|
+
|
81
|
+
collection_class.serials_for_prestage @default_computer_prestage.displayName
|
82
|
+
say "Ran #{collection_class}.serials_for_prestage '#{@default_computer_prestage.displayName}'"
|
83
|
+
end
|
84
|
+
|
85
|
+
##########
|
86
|
+
def assigned_prestage_id
|
87
|
+
looked_up_id = collection_class.assigned_prestage_id @sampled_sn, :refresh
|
88
|
+
say "Ran #{collection_class}.assiged_prestage_id '#{@sampled_sn}', :refresh"
|
89
|
+
|
90
|
+
if looked_up_id == @sample_prestage_id
|
91
|
+
say "Prestage id returned was '#{looked_up_id}' as expected"
|
92
|
+
return
|
93
|
+
end
|
94
|
+
|
95
|
+
raise "Prestage id returned was '#{looked_up_id}' but expected '#{@sample_prestage_id}'"
|
96
|
+
end
|
97
|
+
|
98
|
+
##########
|
99
|
+
def assigned_via_class
|
100
|
+
assigned = collection_class.assigned? @sampled_sn, refresh: false
|
101
|
+
say "Ran #{collection_class}.assigned? '#{@sampled_sn}', refresh: false"
|
102
|
+
raise "Expected #{collection_class}.assigned? '#{@sampled_sn}' to return true, but got false" unless assigned
|
103
|
+
|
104
|
+
assigned = collection_class.assigned? 'NotA-Real-SerialNumber', refresh: false
|
105
|
+
say "Ran #{collection_class}.assigned? 'NotA-Real-SerialNumber', refresh: false"
|
106
|
+
raise "Expected #{collection_class}.assigned? 'NotA-Real-SerialNumber' to return false, but got true" if assigned
|
107
|
+
end
|
108
|
+
|
109
|
+
###########
|
110
|
+
def scope
|
111
|
+
@default_computer_prestage_scope = @default_computer_prestage.scope
|
112
|
+
say "Ran #{collection_class}#scope on default prestage"
|
113
|
+
unless @default_computer_prestage_scope.is_a?(Jamf::OAPISchemas::PrestageScopeResponseV2)
|
114
|
+
raise 'Returned scope is not a Jamf::OAPISchemas::PrestageScopeResponseV2'
|
115
|
+
end
|
116
|
+
|
117
|
+
say 'Validating #assignments'
|
118
|
+
validate_array @default_computer_prestage_scope.assignments, item_class: Jamf::OAPISchemas::PrestageScopeAssignmentV2
|
119
|
+
say 'scope assignments are valid'
|
120
|
+
end
|
121
|
+
|
122
|
+
##############
|
123
|
+
def assigned_via_scope
|
124
|
+
assigned = @default_computer_prestage.assigned? @sampled_sn
|
125
|
+
say "Ran @default_computer_prestage.assigned? '#{@sampled_sn}'"
|
126
|
+
raise "Expected @default_computer_prestage.assigned? '#{@sampled_sn}' to return true, but got false" unless assigned
|
127
|
+
|
128
|
+
assigned = @default_computer_prestage.assigned? 'NotA-Real-SerialNumber'
|
129
|
+
say "Ran @default_computer_prestage.assigned? 'NotA-Real-SerialNumber'"
|
130
|
+
raise "Expected @default_computer_prestage.assigned? 'NotA-Real-SerialNumber' to return false, but got true" if assigned
|
131
|
+
end
|
132
|
+
|
133
|
+
end # module
|
134
|
+
|
135
|
+
end # module JamfTest
|
data/test/lib/jamf_test.rb
CHANGED
@@ -63,4 +63,10 @@ end # module JamfTest
|
|
63
63
|
# load in the rest of the module
|
64
64
|
libdir = Pathname.new File.dirname(__FILE__)
|
65
65
|
moduledir = libdir + 'jamf_test'
|
66
|
-
|
66
|
+
|
67
|
+
# order matters, of course
|
68
|
+
require "#{moduledir}/auth"
|
69
|
+
require "#{moduledir}/APITest"
|
70
|
+
require "#{moduledir}/collection_tests"
|
71
|
+
require "#{moduledir}/prestage_tests"
|
72
|
+
require "#{moduledir}/advanced_search"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
### Copyright 2022 Pixar
|
2
|
+
|
3
|
+
###
|
4
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
+
### with the following modification; you may not use this file except in
|
6
|
+
### compliance with the Apache License and the following modification to it:
|
7
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
+
###
|
9
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
10
|
+
### names, trademarks, service marks, or product names of the Licensor
|
11
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
12
|
+
### the License and to reproduce the content of the NOTICE file.
|
13
|
+
###
|
14
|
+
### You may obtain a copy of the Apache License at
|
15
|
+
###
|
16
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
###
|
18
|
+
### Unless required by applicable law or agreed to in writing, software
|
19
|
+
### distributed under the Apache License with the above modification is
|
20
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
+
### KIND, either express or implied. See the Apache License for the specific
|
22
|
+
### language governing permissions and limitations under the Apache License.
|
23
|
+
###
|
24
|
+
###
|
25
|
+
|
26
|
+
module JamfTest
|
27
|
+
|
28
|
+
class AdvancedComputerSearch < JamfTest::APITest
|
29
|
+
|
30
|
+
include JamfTest::AdvancedSearchTests
|
31
|
+
|
32
|
+
COLLECTION_CLASS = Jamf::AdvancedComputerSearch
|
33
|
+
|
34
|
+
end # class
|
35
|
+
|
36
|
+
end # module JamfTest
|
@@ -0,0 +1,36 @@
|
|
1
|
+
### Copyright 2022 Pixar
|
2
|
+
|
3
|
+
###
|
4
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
+
### with the following modification; you may not use this file except in
|
6
|
+
### compliance with the Apache License and the following modification to it:
|
7
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
+
###
|
9
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
10
|
+
### names, trademarks, service marks, or product names of the Licensor
|
11
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
12
|
+
### the License and to reproduce the content of the NOTICE file.
|
13
|
+
###
|
14
|
+
### You may obtain a copy of the Apache License at
|
15
|
+
###
|
16
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
###
|
18
|
+
### Unless required by applicable law or agreed to in writing, software
|
19
|
+
### distributed under the Apache License with the above modification is
|
20
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
+
### KIND, either express or implied. See the Apache License for the specific
|
22
|
+
### language governing permissions and limitations under the Apache License.
|
23
|
+
###
|
24
|
+
###
|
25
|
+
|
26
|
+
module JamfTest
|
27
|
+
|
28
|
+
class AdvancedMobileDeviceSearch < JamfTest::APITest
|
29
|
+
|
30
|
+
include JamfTest::AdvancedSearchTests
|
31
|
+
|
32
|
+
COLLECTION_CLASS = Jamf::AdvancedMobileDeviceSearch
|
33
|
+
|
34
|
+
end # class
|
35
|
+
|
36
|
+
end # module JamfTest
|
@@ -0,0 +1,36 @@
|
|
1
|
+
### Copyright 2022 Pixar
|
2
|
+
|
3
|
+
###
|
4
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
+
### with the following modification; you may not use this file except in
|
6
|
+
### compliance with the Apache License and the following modification to it:
|
7
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
+
###
|
9
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
10
|
+
### names, trademarks, service marks, or product names of the Licensor
|
11
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
12
|
+
### the License and to reproduce the content of the NOTICE file.
|
13
|
+
###
|
14
|
+
### You may obtain a copy of the Apache License at
|
15
|
+
###
|
16
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
###
|
18
|
+
### Unless required by applicable law or agreed to in writing, software
|
19
|
+
### distributed under the Apache License with the above modification is
|
20
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
+
### KIND, either express or implied. See the Apache License for the specific
|
22
|
+
### language governing permissions and limitations under the Apache License.
|
23
|
+
###
|
24
|
+
###
|
25
|
+
|
26
|
+
module JamfTest
|
27
|
+
|
28
|
+
class AdvancedUserSearch < JamfTest::APITest
|
29
|
+
|
30
|
+
include JamfTest::AdvancedSearchTests
|
31
|
+
|
32
|
+
COLLECTION_CLASS = Jamf::AdvancedUserSearch
|
33
|
+
|
34
|
+
end # class
|
35
|
+
|
36
|
+
end # module JamfTest
|
@@ -0,0 +1,36 @@
|
|
1
|
+
### Copyright 2022 Pixar
|
2
|
+
|
3
|
+
###
|
4
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
+
### with the following modification; you may not use this file except in
|
6
|
+
### compliance with the Apache License and the following modification to it:
|
7
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
+
###
|
9
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
10
|
+
### names, trademarks, service marks, or product names of the Licensor
|
11
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
12
|
+
### the License and to reproduce the content of the NOTICE file.
|
13
|
+
###
|
14
|
+
### You may obtain a copy of the Apache License at
|
15
|
+
###
|
16
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
###
|
18
|
+
### Unless required by applicable law or agreed to in writing, software
|
19
|
+
### distributed under the Apache License with the above modification is
|
20
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
+
### KIND, either express or implied. See the Apache License for the specific
|
22
|
+
### language governing permissions and limitations under the Apache License.
|
23
|
+
###
|
24
|
+
###
|
25
|
+
|
26
|
+
module JamfTest
|
27
|
+
|
28
|
+
class ComputerPrestage < JamfTest::APITest
|
29
|
+
|
30
|
+
include JamfTest::PrestageTests
|
31
|
+
|
32
|
+
COLLECTION_CLASS = Jamf::ComputerPrestage
|
33
|
+
|
34
|
+
end # class
|
35
|
+
|
36
|
+
end # module JamfTest
|
@@ -42,7 +42,7 @@ module JamfTest
|
|
42
42
|
def run_class_tests
|
43
43
|
run_collection_tests do_object_tests: false
|
44
44
|
|
45
|
-
# object tests... some from the mixin, others overridden here
|
45
|
+
# custom object tests... some from the mixin, others overridden here
|
46
46
|
create_new # in mixin
|
47
47
|
add_data_to_new_with_failures
|
48
48
|
save_new_with_failures
|
@@ -52,7 +52,7 @@ module JamfTest
|
|
52
52
|
by_name: false,
|
53
53
|
by_searchterm: true,
|
54
54
|
by_ident: :serialNumber,
|
55
|
-
val_to_fetch:
|
55
|
+
val_to_fetch: TEST_SN
|
56
56
|
) # in mixin
|
57
57
|
validate_fetched # in mixin
|
58
58
|
modify_fetched
|
@@ -0,0 +1,37 @@
|
|
1
|
+
### Copyright 2022 Pixar
|
2
|
+
|
3
|
+
###
|
4
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
5
|
+
### with the following modification; you may not use this file except in
|
6
|
+
### compliance with the Apache License and the following modification to it:
|
7
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
8
|
+
###
|
9
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
10
|
+
### names, trademarks, service marks, or product names of the Licensor
|
11
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
12
|
+
### the License and to reproduce the content of the NOTICE file.
|
13
|
+
###
|
14
|
+
### You may obtain a copy of the Apache License at
|
15
|
+
###
|
16
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
###
|
18
|
+
### Unless required by applicable law or agreed to in writing, software
|
19
|
+
### distributed under the Apache License with the above modification is
|
20
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
21
|
+
### KIND, either express or implied. See the Apache License for the specific
|
22
|
+
### language governing permissions and limitations under the Apache License.
|
23
|
+
###
|
24
|
+
###
|
25
|
+
|
26
|
+
module JamfTest
|
27
|
+
|
28
|
+
class MobileDevicePrestage < JamfTest::APITest
|
29
|
+
|
30
|
+
include JamfTest::PrestageTests
|
31
|
+
|
32
|
+
COLLECTION_CLASS = Jamf::MobileDevicePrestage
|
33
|
+
|
34
|
+
|
35
|
+
end # class
|
36
|
+
|
37
|
+
end # module JamfTest
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-jss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.0a11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Lasell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-04-
|
13
|
+
date: 2022-04-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: CFPropertyList
|
@@ -807,12 +807,19 @@ files:
|
|
807
807
|
- test/bin/runtests
|
808
808
|
- test/lib/jamf_test.rb
|
809
809
|
- test/lib/jamf_test/APITest.rb
|
810
|
+
- test/lib/jamf_test/advanced_search.rb
|
810
811
|
- test/lib/jamf_test/auth.rb
|
811
812
|
- test/lib/jamf_test/collection_tests.rb
|
813
|
+
- test/lib/jamf_test/prestage_tests.rb
|
814
|
+
- test/tests/advanced_computer_search.rb
|
815
|
+
- test/tests/advanced_mobile_device_search.rb
|
816
|
+
- test/tests/advanced_user_search.rb
|
812
817
|
- test/tests/category.rb
|
818
|
+
- test/tests/computer_prestage.rb
|
813
819
|
- test/tests/device_enrollment.rb
|
814
820
|
- test/tests/inventory_preload_record.rb
|
815
821
|
- test/tests/jp_building.rb
|
822
|
+
- test/tests/mobile_device_prestage.rb
|
816
823
|
- test/tests/policy.rb
|
817
824
|
homepage: http://pixaranimationstudios.github.io/ruby-jss/
|
818
825
|
licenses:
|
@@ -831,7 +838,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
831
838
|
requirements:
|
832
839
|
- - ">="
|
833
840
|
- !ruby/object:Gem::Version
|
834
|
-
version: 2.
|
841
|
+
version: 2.6.3
|
835
842
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
836
843
|
requirements:
|
837
844
|
- - ">"
|