Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
76 additions
and
3 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
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,26 @@ | ||
from django.test import TestCase | ||
from .base import MqueueBaseTest | ||
from graphene.test import Client | ||
from mqueue.schema import schema | ||
from mqueue.models import MEvent | ||
|
||
|
||
client = Client(schema) | ||
|
||
|
||
class MqueueTestGraphqlApi(MqueueBaseTest): | ||
|
||
def test_graphql_query(self): | ||
self.reset() | ||
MEvent.objects.create(name="Test public event", scope="public") | ||
query = '''query publicEvents(first:10) { | ||
edges { | ||
node { | ||
name | ||
event_class | ||
} | ||
} | ||
} | ||
''' | ||
res = [{"name": "Test public event"}] | ||
self.assertEqual(client.execute(query), res) |
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,28 @@ | ||
from django.test import TestCase | ||
from .base import MqueueBaseTest | ||
from mqueue.models import MEvent | ||
from mqueue.watchers import send_msg, login_action, logout_action, login_failed, init_watchers | ||
from mqueue.conf import WATCH | ||
|
||
|
||
class MqueueTestWatchers(MqueueBaseTest): | ||
|
||
def test_send_msg(self): | ||
instance = self.user | ||
send_msg("test", instance, "Event string") | ||
|
||
def test_login_action(self): | ||
instance = self.user | ||
login_action("test", instance) | ||
|
||
def test_logout_action(self): | ||
instance = self.user | ||
logout_action("test", instance) | ||
|
||
def test_login_failed(self): | ||
instance = self.user | ||
login_failed("test", "user") | ||
|
||
def test_init_watchers_login(self): | ||
with self.settings(MQUEUE_WATCH=["login", "logout", "login_failed"]): | ||
init_watchers("login") |
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 |
---|---|---|
|
@@ -25,7 +25,8 @@ | |
'django<2', | ||
'redis', | ||
'influxdb', | ||
'graphene', | ||
'django-graphql-utils', | ||
"graphene-django<2.0", | ||
], | ||
zip_safe=False | ||
) |
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