@testable import ForgejoKit import Foundation import Testing struct AdminServiceTests { @Test func createUserPayloadEncodesCorrectKeys() throws { let json = """ { "username": "testbot", "password": "testbot1234", "email": "testbot@test.local", "login_name": "testbot", "full_name": "Test Bot", "must_change_password": false, "send_notify": false, "source_id": 0, "visibility": "public" } """ let data = Data(json.utf8) let dict = try #require(JSONSerialization.jsonObject(with: data) as? [String: Any]) #expect(dict["username"] as? String == "testbot") #expect(dict["login_name"] as? String == "testbot") #expect(dict["must_change_password"] as? Bool == false) #expect(dict["send_notify"] as? Bool == false) #expect(dict["source_id"] as? Int == 0) #expect(dict["visibility"] as? String == "public") } @Test func createUserURLConstruction() throws { let client = ForgejoClient(serverURL: "https://forgejo.example.com", username: "admin", password: "pass") let url = try client.makeURL(path: "/api/v1/admin/users") #expect(url.absoluteString == "https://forgejo.example.com/api/v1/admin/users") } }