Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test resources for Assistants and Threads #279

Merged

Conversation

elodieirdor
Copy link
Contributor

What:

  • Bug Fix
  • New Feature

Description:

This PR adds test resources for Assistants and Threads.

Related:

@gehrisandro
Copy link
Collaborator

Thank you @elodieirdor

I missed them completely 🙈

@gehrisandro gehrisandro merged commit 36dd3a0 into openai-php:main Nov 29, 2023
@elodieirdor
Copy link
Contributor Author

Thanks for the merged! Happy to contribute to this great package!!
Just realized I broke the tests. Sorry about that! Happy to do a PR with a fix.

Would that be ok if I update OpenAI\Testing\Resources\Concerns\Testable.php with the following

    protected function record(string $method, ...$parameters): ResponseContract|StreamResponse|string
    {
        return $this->fake->record(new TestRequest($this->resource(), $method, $parameters));
    }

Or, I can update each new resource class and send an array ['paramName' => value] to record
Example for create in OpenAI\Testing\Resources\AssistantsFilesTestResource

    public function create(string $assistantId, array $parameters): AssistantFileResponse
    {
        return $this->record(__FUNCTION__, ['assistantId' => $assistantId, 'parameters' => $parameters]);
    }

@gehrisandro
Copy link
Collaborator

No problem.

I am already working on this one. I've done basically what you have suggested now. Additionally I am going to add the missing tests for the test resources.

@elodieirdor
Copy link
Contributor Author

Awesome ❤️ . Thank you!

@gehrisandro
Copy link
Collaborator

Here is my commit: da39523

I will tag a new release tomorrow.

@elodieirdor
Copy link
Contributor Author

Great!! Thanks.

@elodieirdor elodieirdor deleted the add_tests_resources_for_assistants branch November 29, 2023 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants