Skip to content

Commit e4912b1

Browse files
committed
Conditionalize HuggingFaceAuthenticationManagerTests to avoid availability issue
1 parent ee42dbd commit e4912b1

File tree

1 file changed

+90
-90
lines changed

1 file changed

+90
-90
lines changed

Tests/HuggingFaceTests/OAuthTests/HuggingFaceAuthenticationManagerTests.swift

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -89,100 +89,100 @@ import Testing
8989
}
9090
}
9191
}
92-
#endif // swift(>=6.1)
9392

94-
@Suite("Hugging Face OAuth Scope Tests", .serialized)
95-
struct HuggingFaceScopeTests {
96-
typealias Scope = HuggingFaceAuthenticationManager.Scope
97-
98-
@Test("OAuth Scope sets work correctly")
99-
func testScopeSets() {
100-
// Test basic scope set
101-
let basicScopes = Set<Scope>.basic
102-
#expect(basicScopes.contains(.openid))
103-
#expect(basicScopes.contains(.profile))
104-
#expect(basicScopes.contains(.email))
105-
106-
// Test read access scope set
107-
let readScopes = Set<Scope>.readAccess
108-
#expect(readScopes.contains(.readRepos))
109-
110-
// Test write access scope set
111-
let writeScopes = Set<Scope>.writeAccess
112-
#expect(writeScopes.contains(.writeRepos))
113-
114-
// Test full access scope set
115-
let fullScopes = Set<Scope>.fullAccess
116-
#expect(fullScopes.contains(.manageRepos))
117-
#expect(fullScopes.contains(.inferenceAPI))
118-
119-
// Test inference only scope set
120-
let inferenceScopes = Set<Scope>.inferenceOnly
121-
#expect(inferenceScopes.contains(.openid))
122-
#expect(inferenceScopes.contains(.inferenceAPI))
123-
124-
// Test discussions scope set
125-
let discussionScopes = Set<Scope>.discussions
126-
#expect(discussionScopes.contains(.writeDiscussions))
127-
}
93+
@Suite("Hugging Face OAuth Scope Tests", .serialized)
94+
struct HuggingFaceScopeTests {
95+
typealias Scope = HuggingFaceAuthenticationManager.Scope
96+
97+
@Test("OAuth Scope sets work correctly")
98+
func testScopeSets() {
99+
// Test basic scope set
100+
let basicScopes = Set<Scope>.basic
101+
#expect(basicScopes.contains(.openid))
102+
#expect(basicScopes.contains(.profile))
103+
#expect(basicScopes.contains(.email))
104+
105+
// Test read access scope set
106+
let readScopes = Set<Scope>.readAccess
107+
#expect(readScopes.contains(.readRepos))
108+
109+
// Test write access scope set
110+
let writeScopes = Set<Scope>.writeAccess
111+
#expect(writeScopes.contains(.writeRepos))
112+
113+
// Test full access scope set
114+
let fullScopes = Set<Scope>.fullAccess
115+
#expect(fullScopes.contains(.manageRepos))
116+
#expect(fullScopes.contains(.inferenceAPI))
117+
118+
// Test inference only scope set
119+
let inferenceScopes = Set<Scope>.inferenceOnly
120+
#expect(inferenceScopes.contains(.openid))
121+
#expect(inferenceScopes.contains(.inferenceAPI))
122+
123+
// Test discussions scope set
124+
let discussionScopes = Set<Scope>.discussions
125+
#expect(discussionScopes.contains(.writeDiscussions))
126+
}
128127

129-
@Test("OAuth Scope raw values are correct")
130-
func testScopeRawValues() {
131-
#expect(Scope.openid.rawValue == "openid")
132-
#expect(Scope.profile.rawValue == "profile")
133-
#expect(Scope.email.rawValue == "email")
134-
#expect(Scope.readBilling.rawValue == "read-billing")
135-
#expect(Scope.readRepos.rawValue == "read-repos")
136-
#expect(Scope.writeRepos.rawValue == "write-repos")
137-
#expect(Scope.manageRepos.rawValue == "manage-repos")
138-
#expect(Scope.inferenceAPI.rawValue == "inference-api")
139-
#expect(Scope.writeDiscussions.rawValue == "write-discussions")
140-
141-
// Test custom scope
142-
let customScope = Scope.other("custom-scope")
143-
#expect(customScope.rawValue == "custom-scope")
144-
}
128+
@Test("OAuth Scope raw values are correct")
129+
func testScopeRawValues() {
130+
#expect(Scope.openid.rawValue == "openid")
131+
#expect(Scope.profile.rawValue == "profile")
132+
#expect(Scope.email.rawValue == "email")
133+
#expect(Scope.readBilling.rawValue == "read-billing")
134+
#expect(Scope.readRepos.rawValue == "read-repos")
135+
#expect(Scope.writeRepos.rawValue == "write-repos")
136+
#expect(Scope.manageRepos.rawValue == "manage-repos")
137+
#expect(Scope.inferenceAPI.rawValue == "inference-api")
138+
#expect(Scope.writeDiscussions.rawValue == "write-discussions")
139+
140+
// Test custom scope
141+
let customScope = Scope.other("custom-scope")
142+
#expect(customScope.rawValue == "custom-scope")
143+
}
145144

146-
@Test("OAuth Scope initialization from raw values")
147-
func testScopeInitializationFromRawValue() {
148-
#expect(Scope(rawValue: "openid") == .openid)
149-
#expect(Scope(rawValue: "profile") == .profile)
150-
#expect(Scope(rawValue: "email") == .email)
151-
#expect(Scope(rawValue: "read-billing") == .readBilling)
152-
#expect(Scope(rawValue: "read-repos") == .readRepos)
153-
#expect(Scope(rawValue: "write-repos") == .writeRepos)
154-
#expect(Scope(rawValue: "manage-repos") == .manageRepos)
155-
#expect(Scope(rawValue: "inference-api") == .inferenceAPI)
156-
#expect(Scope(rawValue: "write-discussions") == .writeDiscussions)
157-
158-
// Test custom scope
159-
let customScope = Scope(rawValue: "custom-scope")
160-
#expect(customScope == .other("custom-scope"))
161-
}
145+
@Test("OAuth Scope initialization from raw values")
146+
func testScopeInitializationFromRawValue() {
147+
#expect(Scope(rawValue: "openid") == .openid)
148+
#expect(Scope(rawValue: "profile") == .profile)
149+
#expect(Scope(rawValue: "email") == .email)
150+
#expect(Scope(rawValue: "read-billing") == .readBilling)
151+
#expect(Scope(rawValue: "read-repos") == .readRepos)
152+
#expect(Scope(rawValue: "write-repos") == .writeRepos)
153+
#expect(Scope(rawValue: "manage-repos") == .manageRepos)
154+
#expect(Scope(rawValue: "inference-api") == .inferenceAPI)
155+
#expect(Scope(rawValue: "write-discussions") == .writeDiscussions)
156+
157+
// Test custom scope
158+
let customScope = Scope(rawValue: "custom-scope")
159+
#expect(customScope == .other("custom-scope"))
160+
}
162161

163-
@Test("OAuth Scope descriptions are correct")
164-
func testScopeDescriptions() {
165-
#expect(Scope.openid.description.contains("ID token"))
166-
#expect(Scope.profile.description.contains("profile information"))
167-
#expect(Scope.email.description.contains("email address"))
168-
#expect(Scope.readBilling.description.contains("payment method"))
169-
#expect(Scope.readRepos.description.contains("read access"))
170-
#expect(Scope.writeRepos.description.contains("write/read access"))
171-
#expect(Scope.manageRepos.description.contains("full access"))
172-
#expect(Scope.inferenceAPI.description.contains("Inference API"))
173-
#expect(Scope.writeDiscussions.description.contains("discussions"))
174-
175-
// Test custom scope description
176-
let customScope = Scope.other("custom-scope")
177-
#expect(customScope.description == "custom-scope")
178-
}
162+
@Test("OAuth Scope descriptions are correct")
163+
func testScopeDescriptions() {
164+
#expect(Scope.openid.description.contains("ID token"))
165+
#expect(Scope.profile.description.contains("profile information"))
166+
#expect(Scope.email.description.contains("email address"))
167+
#expect(Scope.readBilling.description.contains("payment method"))
168+
#expect(Scope.readRepos.description.contains("read access"))
169+
#expect(Scope.writeRepos.description.contains("write/read access"))
170+
#expect(Scope.manageRepos.description.contains("full access"))
171+
#expect(Scope.inferenceAPI.description.contains("Inference API"))
172+
#expect(Scope.writeDiscussions.description.contains("discussions"))
173+
174+
// Test custom scope description
175+
let customScope = Scope.other("custom-scope")
176+
#expect(customScope.description == "custom-scope")
177+
}
179178

180-
@Test("OAuth Scope string literal support")
181-
func testScopeStringLiteral() {
182-
let scope: Scope = "openid"
183-
#expect(scope == .openid)
179+
@Test("OAuth Scope string literal support")
180+
func testScopeStringLiteral() {
181+
let scope: Scope = "openid"
182+
#expect(scope == .openid)
184183

185-
let customScope: Scope = "custom-scope"
186-
#expect(customScope == .other("custom-scope"))
184+
let customScope: Scope = "custom-scope"
185+
#expect(customScope == .other("custom-scope"))
186+
}
187187
}
188-
}
188+
#endif // swift(>=6.1)

0 commit comments

Comments
 (0)