@@ -51,10 +51,83 @@ Describe 'New-Video' {
5151 Model = ' sora-2-pro'
5252 InputReference = (Join-Path $script :TestData ' sweets_donut.png' )
5353 Seconds = 12
54+ Size = ' 1280x720'
5455 }
5556 $script :Result = New-Video @Params - ea Stop
5657 } | Should -Not - Throw
5758 Should - Invoke - CommandName Invoke-OpenAIAPIRequest - ModuleName $script :ModuleName - Times 1 - Exactly
5859 }
5960 }
61+
62+ Context ' Integration tests (online)' - Tag ' Online' {
63+
64+ BeforeAll {
65+ Clear-OpenAIContext
66+ }
67+
68+ BeforeEach {
69+ $script :Result = ' '
70+ }
71+
72+ It ' Create a video job' {
73+ {
74+ $Params = @ {
75+ Prompt = ' Dancing Donuts'
76+ Model = ' sora-2'
77+ Seconds = 4
78+ Size = ' 1280x720'
79+ TimeoutSec = 30
80+ MaxRetryCount = 1
81+ }
82+ $script :Result = New-Video @Params - ea Stop
83+ } | Should -Not - Throw
84+ Should - Invoke - CommandName Invoke-OpenAIAPIRequest - ModuleName $script :ModuleName - Times 1 - Exactly
85+ $Result | Should - BeOfType [pscustomobject ]
86+ $Result.psobject.TypeNames | Should - Contain ' PSOpenAI.Video.Job'
87+ $Result.id | Should -Not - BeNullOrEmpty
88+ $Result.created_at | Should - BeOfType [datetime ]
89+ }
90+ }
91+
92+ Context ' Integration tests (Azure OpenAI)' - Tag ' Azure' {
93+
94+ BeforeAll {
95+ # Set Context for Azure OpenAI
96+ $AzureContext = @ {
97+ ApiType = ' Azure'
98+ AuthType = ' Azure'
99+ ApiKey = $env: AZURE_OPENAI_API_KEY
100+ ApiBase = $env: AZURE_OPENAI_ENDPOINT
101+ TimeoutSec = 30
102+ }
103+ Set-OpenAIContext @AzureContext
104+ }
105+
106+ BeforeEach {
107+ $script :Result = ' '
108+ }
109+
110+ AfterAll {
111+ Clear-OpenAIContext
112+ }
113+
114+ It ' Create a video job' {
115+ {
116+ $Params = @ {
117+ Prompt = ' Dancing Donuts'
118+ Model = ' sora'
119+ Seconds = 3
120+ Size = ' 480x480'
121+ TimeoutSec = 30
122+ MaxRetryCount = 1
123+ }
124+ $script :Result = New-Video @Params - ea Stop
125+ } | Should -Not - Throw
126+ Should - Invoke - CommandName Invoke-OpenAIAPIRequest - ModuleName $script :ModuleName - Times 1 - Exactly
127+ $Result | Should - BeOfType [pscustomobject ]
128+ $Result.psobject.TypeNames | Should - Contain ' PSOpenAI.Video.Job'
129+ $Result.id | Should -Not - BeNullOrEmpty
130+ $Result.created_at | Should - BeOfType [datetime ]
131+ }
132+ }
60133}
0 commit comments