Dismantle REST API #55

Merged
inex merged 130 commits from remove-rest into master 2024-01-09 20:58:51 +02:00
Collaborator

Triggered by: CI having problems with TestClient as used in REST testing.

How do we do it:

  • Remove tests that have GraphQL counterparts
    • Auth
    • System
    • Users
    • Services
  • Add tests to GraphQL so that we can remove them from REST
    • Services
    • System
    • Users
  • Remove all REST tests
  • Remove all REST code
  • Migrate to new service settings storage scheme
  • Bump version to 3.0.0

For adding tests to be efficient, one wants #40 to merge first, ideally.

Triggered by: CI having problems with TestClient as used in REST testing. How do we do it: - [x] Remove tests that have GraphQL counterparts - [x] Auth - [x] System - [x] Users - [x] Services - [x] Add tests to GraphQL so that we can remove them from REST - [x] Services - [x] System - [x] Users - [x] Remove all REST tests - [x] Remove all REST code - [x] Migrate to new service settings storage scheme - [x] Bump version to 3.0.0 For adding tests to be efficient, one wants #40 to merge first, ideally.
houkime added 3 commits 2023-08-14 20:06:17 +03:00
houkime added 53 commits 2023-10-11 21:31:26 +03:00
houkime added 24 commits 2023-11-24 13:30:01 +02:00
continuous-integration/drone/push Build is failing Details
de94e55dbd
test(services, system): untie dkim tests from rest
houkime added 1 commit 2023-11-24 13:32:15 +02:00
continuous-integration/drone/push Build is failing Details
4e25362493
test(services): remove redundant nextcloud tests
houkime added 1 commit 2023-11-24 13:34:34 +02:00
continuous-integration/drone/push Build is failing Details
c88cb14b44
test(services): remove redundant ocserv tests
houkime added 1 commit 2023-11-24 13:37:56 +02:00
continuous-integration/drone/push Build is failing Details
5733e36e0c
test(services): remove redundant pleroma tests
houkime added 1 commit 2023-11-24 13:54:45 +02:00
continuous-integration/drone/push Build is failing Details
05f86184ec
test(services): remove legacy restic test data
houkime added 1 commit 2023-11-24 16:17:06 +02:00
continuous-integration/drone/push Build is failing Details
81ed0aae75
test(services): untie dkim-related service tests from rest
houkime force-pushed remove-rest from 81ed0aae75 to b49343555b 2023-12-08 10:51:11 +02:00 Compare
inex requested changes 2023-12-12 06:56:18 +02:00
@ -16,3 +18,4 @@
from selfprivacy_api.jobs import Jobs, JobStatus, Job
SNAPSHOT_CACHE_TTL_HOURS = 6

Duplicate constant declaration

Duplicate constant declaration
Poster
Collaborator

addressed

addressed
houkime marked this conversation as resolved
@ -167,3 +179,1 @@
service=service_to_graphql_service(service),
job=job_to_api_job(job),
)
if job.status == JobStatus.FINISHED:

I think that it is likely that this will return 400 all the time. It should return the message like "Started moving the service".

I think that it is likely that this will return 400 all the time. It should return the message like "Started moving the service".
Poster
Collaborator

It is not an async call, just a very long one. It returns when it is either finished or failed.

It is not an async call, just a very long one. It returns when it is either finished or failed.
Poster
Collaborator

added more handlers

added more handlers
houkime marked this conversation as resolved
@ -170,2 +170,4 @@
def get_dkim_key(domain: str, parse: bool = True) -> typing.Optional[str]:
"""Get DKIM key from /var/dkim/<domain>.selector.txt"""
if os.path.exists("/var/dkim/" + domain + ".selector.txt"):
# Is this really neccessary to use Popen here?

No, looks like a leftover that can be refactored.

No, looks like a leftover that can be refactored.
houkime marked this conversation as resolved
@ -8,0 +21,4 @@
TESTFILE_2_BODY = "testissimo!"
@pytest.fixture()

These fixtures are unused in this file. Maybe they should be in conftest.py?

These fixtures are unused in this file. Maybe they should be in `conftest.py`?
houkime marked this conversation as resolved
@ -0,0 +91,4 @@
###############################################################################
def test_dkim_key(authorized_client, mock_subproccess_popen):

...I wonder how did we end up with dkim in these tests?

These are clearly not related to DKIM anymore. File should be renamed too.

...I wonder how did we end up with `dkim` in these tests? These are clearly not related to DKIM anymore. File should be renamed too.
houkime marked this conversation as resolved
houkime added 43 commits 2023-12-22 12:18:25 +02:00
continuous-integration/drone/push Build is failing Details
820f905d6a
test(ssh): remove the rest of rest ssh tests bc redundant
houkime added 5 commits 2023-12-25 19:15:10 +02:00
houkime added 8 commits 2023-12-27 16:47:48 +02:00
houkime added 3 commits 2023-12-29 15:14:42 +02:00
houkime added 5 commits 2023-12-29 17:20:26 +02:00
houkime added 4 commits 2024-01-03 21:33:24 +02:00
houkime force-pushed remove-rest from 5e2757e38e to 2b21df9ad3 2024-01-08 15:16:25 +02:00 Compare
houkime changed title from WIP: Dismantle REST API to Dismantle REST API 2024-01-08 15:19:55 +02:00
Poster
Collaborator

@inex I think this one is ready.

@inex I think this one is ready.
Poster
Collaborator

but there is an unrelated error in CI, will work on it separately.

but there is an unrelated error in CI, will work on it separately.
houkime requested review from inex 2024-01-08 15:20:58 +02:00
inex approved these changes 2024-01-09 18:13:08 +02:00
inex left a comment
Owner

LGTM. Do not merge yet.

LGTM. ~~Do not merge yet.~~
@ -37,6 +38,7 @@ migrations = [
MigrateToSelfprivacyChannelFrom2205(),
MigrateToSelfprivacyChannelFrom2211(),
LoadTokensToRedis(),
CreateModulesField(),

Not needed, 3.0.0 will run on the system which already has a new userdata structure. I will make an additional PR to account for changes occurred during migration.

Not needed, 3.0.0 will run on the system which already has a new userdata structure. I will make an additional PR to account for changes occurred during migration.
inex merged commit 6b4920a0e7 into master 2024-01-09 20:58:51 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SelfPrivacy/selfprivacy-rest-api#55
There is no content yet.