-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/breatheco-de/apiv2
- Loading branch information
Showing
60 changed files
with
3,808 additions
and
2,074 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,3 +96,4 @@ SCREENSHOT_MACHINE_KEY=00000 | |
|
||
# Email validation | ||
MAILBOX_LAYER_KEY=adsasd | ||
SET_GOOGLE_CREDENTIALS=1 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
|
||
from capyc.core.managers import feature | ||
|
||
flags = feature.flags | ||
|
||
|
||
@feature.availability("authenticate.set_google_credentials") | ||
def set_google_credentials() -> bool: | ||
if os.getenv("SET_GOOGLE_CREDENTIALS") in feature.TRUE: | ||
return True | ||
|
||
return False | ||
|
||
|
||
feature.add(set_google_credentials) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 5.1.2 on 2024-10-22 19:28 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("authenticate", "0058_credentialsgoogle_google_id"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="GoogleWebhook", | ||
fields=[ | ||
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
( | ||
"message", | ||
models.SlugField(blank=True, help_text="base64 message provided by google", max_length=124), | ||
), | ||
( | ||
"status", | ||
models.CharField( | ||
choices=[("PENDING", "Pending"), ("DONE", "Done"), ("ERROR", "Error")], | ||
default="PENDING", | ||
max_length=9, | ||
), | ||
), | ||
("status_text", models.CharField(default="", max_length=255)), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
], | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
breathecode/authenticate/migrations/0060_alter_googlewebhook_message.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.1.2 on 2024-10-22 19:48 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("authenticate", "0059_googlewebhook"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="googlewebhook", | ||
name="message", | ||
field=models.SlugField(blank=True, help_text="base64 message provided by google", max_length=512), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
breathecode/authenticate/migrations/0061_googlewebhook_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.1.2 on 2024-10-22 22:28 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("authenticate", "0060_alter_googlewebhook_message"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="googlewebhook", | ||
name="type", | ||
field=models.CharField(default="noSet", max_length=40), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
breathecode/authenticate/tests/signals/tests_google_webhook_saved.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from unittest.mock import MagicMock, call | ||
|
||
import capyc.pytest as capy | ||
import pytest | ||
|
||
from breathecode.notify import tasks | ||
from breathecode.payments.tasks import process_google_webhook | ||
from breathecode.tests.mixins.breathecode_mixin.breathecode import Breathecode | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def setup(db, monkeypatch): | ||
monkeypatch.setattr("breathecode.payments.tasks.process_google_webhook.delay", MagicMock()) | ||
yield | ||
|
||
|
||
def test_each_webhook_is_processed(database: capy.Database, signals: capy.Signals, format: capy.Format): | ||
signals.enable("breathecode.authenticate.signals.google_webhook_saved") | ||
|
||
model = database.create( | ||
google_webhook=2, | ||
) | ||
|
||
assert database.list_of("authenticate.GoogleWebhook") == [ | ||
format.to_obj_repr(model.google_webhook[0]), | ||
format.to_obj_repr(model.google_webhook[1]), | ||
] | ||
|
||
assert process_google_webhook.delay.call_args_list == [ | ||
call(1), | ||
call(2), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.