Skip to content

refactoring tests with mock servers (#30)#356

Merged
sashabaranov merged 1 commit intosashabaranov:masterfrom
vvatanabe:Refactoring-tests-with-mock-servers-30
Jun 12, 2023
Merged

refactoring tests with mock servers (#30)#356
sashabaranov merged 1 commit intosashabaranov:masterfrom
vvatanabe:Refactoring-tests-with-mock-servers-30

Conversation

@vvatanabe
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Collaborator Author

@sashabaranov Please check it.

Copy link
Copy Markdown
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
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.

2 participants