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

refactoring tests with mock servers (#30) #356

Conversation

vvatanabe
Copy link
Collaborator

@vvatanabe vvatanabe commented Jun 12, 2023

Improve #30

Boilerplate for tests using mock server aggregated into the following function.

  • setupOpenAITestServer() (client *Client, server *test.ServerTest, teardown func())
  • setupAzureTestServer() (client *Client, server *test.ServerTest, teardown func())

This refactoring removed a lot of duplicate test code.

And I split some test files with names like xxx_api_test.go to avoid circular import.

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Merging #356 (75c491c) into master (a243e73) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #356   +/-   ##
=======================================
  Coverage   95.22%   95.22%           
=======================================
  Files          17       17           
  Lines         670      670           
=======================================
  Hits          638      638           
  Misses         22       22           
  Partials       10       10           

@vvatanabe
Copy link
Collaborator Author

@sashabaranov Please check it.

Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the new API, thank you so much! 🙌🏻

+731 −1,060 👀

@sashabaranov sashabaranov merged commit b616090 into sashabaranov:master Jun 12, 2023
3 checks passed
coggsfl added a commit to coggsfl/go-openai that referenced this pull request Jun 12, 2023
coggsfl pushed a commit to coggsfl/go-openai that referenced this pull request Jun 12, 2023
@vvatanabe vvatanabe mentioned this pull request Jun 12, 2023
10 tasks
@vvatanabe vvatanabe deleted the Refactoring-tests-with-mock-servers-30 branch June 12, 2023 21:38
coggsfl pushed a commit to coggsfl/go-openai that referenced this pull request Jun 13, 2023
coggsfl pushed a commit to coggsfl/go-openai that referenced this pull request Jun 13, 2023
sashabaranov pushed a commit that referenced this pull request Jun 14, 2023
* Improve (#356) to support registration of wildcard URLs

* Add TestAzureChatCompletions & TestAzureChatCompletionsWithCustomDeploymentName

* Remove TestAzureChatCompletionsWithCustomDeploymentName

---------

Co-authored-by: coggsflod <richard.coggins@officedepot.com>
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.

None yet

2 participants