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 app unit tests to app internal integration test #1046

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jonsimantov
Copy link
Contributor

Description

Provide details of the change, and generalize the change in the PR title above.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@jonsimantov jonsimantov changed the title Add unit tests to app integration test Add app unit tests to app internal integration test Aug 8, 2022
for (int i = 0; i < args_vector.size(); ++i) {
const char* arg = args_vector[i].c_str();
char* arg_copy = new char[std::strlen(arg) + 1];
std::strcpy(arg_copy, arg);
Copy link

Choose a reason for hiding this comment

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

⚠️ Lint warning: Almost always, snprintf is better than strcpy


// Blocking HTTP request helper function, for testing only.
static bool SendHttpPostRequest(
const char* url, const std::map<std::string, std::string>& headers,
Copy link

Choose a reason for hiding this comment

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

⚠️ Lint warning: Add #include <map> for map<>

static bool Base64Encode(const std::string& input, std::string* output);
// Decode a base64 string to binary. Returns true if the decoding succeeded,
// false if it failed.
static bool Base64Decode(const std::string& input, std::string* output);
Copy link

Choose a reason for hiding this comment

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

⚠️ Lint warning: Add #include <string> for string

@@ -82,12 +81,14 @@ using testing::Not;

namespace firebase {

extern std::string g_test_srcdir;
std::string g_test_srcdir;
Copy link

Choose a reason for hiding this comment

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

⚠️ Lint warning: Static/global string variables are not permitted.

EXPECT_EQ(encoded_firebase, encoded_openssh)
<< "Encoding mismatch on source buffer: " << orig;

std::string decoded_firebase_to_openssh;
std::string decoded_openssh_to_firebase;
ASSERT_TRUE(Base64Decode(encoded_openssh, &decoded_openssh_to_firebase));
ASSERT_TRUE(OpenSSHDecode(encoded_firebase, &decoded_firebase_to_openssh));
ASSERT_TRUE(OpenSSHDecode(&encoded_firebase[0], encoded_firebase.length(),
&decoded_firebase_to_openssh));
Copy link

Choose a reason for hiding this comment

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

⚠️ Lint warning: Tab found; better to use spaces

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.

1 participant