Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
turokg committed Jul 22, 2021
1 parent 117d46c commit 4f48339
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def function_name():

@pytest.fixture(scope="session")
def function(function_name, yc):
function, _ = yc.ensure_function(function_name)
function, _ = yc.create_function(function_name)
yield function
yc.delete_function(function_name)

Expand Down
14 changes: 5 additions & 9 deletions tests/handlers/manage.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os
import sys
from pathlib import Path
Expand All @@ -15,20 +16,15 @@ def django_settings():


def test_help():
response = manage(dict(body=dict(command="help", args=[])))
response = manage({"body": json.dumps({"command": "help", "args": []})})
assert response["statusCode"] == 200
assert response["body"].startswith("\nType 'python -m django")


def test_migrate():
response = manage(dict(body=dict(command="migrate", args=[])))
assert response["statusCode"] == 200
assert response["body"].startswith('settings.DATABASES is improperly ')


def test_arguments():
response = manage(dict(body=dict(command="check", args=[])))
response = manage({"body": json.dumps({"command": "check", "args": []})})
assert response["body"] == (
'System check identified no issues (0 silenced).\n')
response = manage(dict(body=dict(command="check", args=["--deploy"])))
response = manage(
{"body": json.dumps({"command": "check", "args": ["--deploy"]})})
assert response["body"].startswith("System check identified some issues")
2 changes: 1 addition & 1 deletion tests/yc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_get_functions(yc):

def test_function_creation(yc):
function_name = "create-delete-test-function"
function, _ = yc.ensure_function(function_name)
function, _ = yc.create_function(function_name)
assert function.name == function_name
assert function in yc._get_functions()
yc.delete_function(function_name)
Expand Down
3 changes: 0 additions & 3 deletions yappa/handlers/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ def run_command(command, args):


def manage(event, context=None):
logger.error("processing %s", event)
logger.error("body is %s", event["body"])
# logger.error("body is %s", event["body"].decode())
body = json.loads(event["body"])
output_buffer = run_command(body["command"],
body.get("args") or [])
Expand Down

0 comments on commit 4f48339

Please sign in to comment.