Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Add CS API device tests #3029

Merged
merged 4 commits into from
Mar 31, 2023
Merged

Add CS API device tests #3029

merged 4 commits into from
Mar 31, 2023

Conversation

S7evinK
Copy link
Contributor

@S7evinK S7evinK commented Mar 24, 2023

Adds tests for

  • /devices
  • /delete_devices (also adds UIA)

@S7evinK S7evinK added tests Issues related to tests. Missing/Flakey/etc T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Mar 24, 2023
@S7evinK S7evinK requested a review from a team as a code owner March 24, 2023 15:46
@@ -386,11 +386,6 @@ func (a *UserInternalAPI) PerformDeviceUpdate(ctx context.Context, req *api.Perf
}
res.DeviceExists = true

if dev.UserID != req.RequestingUserID {
Copy link
Contributor Author

@S7evinK S7evinK Mar 24, 2023

Choose a reason for hiding this comment

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

Removed because we should never ever hit this case, because we are querying the database for the req.RequestingUserID. (except the database is lying to us?)

Copy link
Member

Choose a reason for hiding this comment

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

Better yet, change this to accept a device struct so we don't need to do a DB lookup at all!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to look up the device, as one device can update another of the same user.

@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Patch coverage: 35.71% and project coverage change: +0.03 🎉

Comparison is base (28d3e29) 65.72% compared to head (752a24a) 65.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3029      +/-   ##
==========================================
+ Coverage   65.72%   65.75%   +0.03%     
==========================================
  Files         495      495              
  Lines       53631    53642      +11     
==========================================
+ Hits        35250    35274      +24     
+ Misses      14716    14704      -12     
+ Partials     3665     3664       -1     
Flag Coverage Δ
unittests 44.49% <35.71%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
clientapi/routing/deactivate.go 46.87% <0.00%> (-7.97%) ⬇️
userapi/api/api.go 70.90% <ø> (ø)
userapi/internal/user_api.go 60.90% <ø> (+0.32%) ⬆️
clientapi/routing/device.go 72.58% <37.50%> (+8.65%) ⬆️
clientapi/routing/routing.go 58.36% <100.00%> (+0.28%) ⬆️

... and 14 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@S7evinK S7evinK added the T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. label Mar 27, 2023
Copy link
Member

@kegsay kegsay left a comment

Choose a reason for hiding this comment

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

Few small things, overall LGTM

clientapi/clientapi_test.go Outdated Show resolved Hide resolved
clientapi/clientapi_test.go Outdated Show resolved Hide resolved
@S7evinK S7evinK merged commit 2854ffe into main Mar 31, 2023
@S7evinK S7evinK deleted the s7evink/csapidevicetests branch March 31, 2023 08:15
Danieloni1 added a commit to globekeeper/dendrite that referenced this pull request May 8, 2023
Danieloni1 added a commit to globekeeper/dendrite that referenced this pull request Jul 12, 2023
Danieloni1 added a commit to globekeeper/dendrite that referenced this pull request Jul 12, 2023
Danieloni1 added a commit to globekeeper/dendrite that referenced this pull request Jul 12, 2023
Danieloni1 added a commit to globekeeper/dendrite that referenced this pull request Jul 12, 2023
Danieloni1 added a commit to globekeeper/dendrite that referenced this pull request Jul 12, 2023
Danieloni1 added a commit to globekeeper/dendrite that referenced this pull request Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. tests Issues related to tests. Missing/Flakey/etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants