Skip to content

Commit

Permalink
fix: tests and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyPettersson85 committed Feb 15, 2023
1 parent c4948a2 commit cfacbbc
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 17 deletions.
3 changes: 0 additions & 3 deletions stream/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ def activity_partial_update(
return self.activities_partial_update(updates=[data])

def activities_partial_update(self, updates=None):

auth_token = self.create_jwt_token("activities", "*", feed_id="*")

data = {"changes": updates or []}
Expand All @@ -195,7 +194,6 @@ def create_redirect_url(self, target_url, user_id, events):
return prepared_request.url

def track_engagements(self, engagements):

auth_token = self.create_jwt_token("*", "*", feed_id="*")
self.post(
"engagement/",
Expand All @@ -205,7 +203,6 @@ def track_engagements(self, engagements):
)

def track_impressions(self, impressions):

auth_token = self.create_jwt_token("*", "*", feed_id="*")
self.post("impression/", auth_token, data=impressions, service_name="analytics")

Expand Down
1 change: 0 additions & 1 deletion stream/collections/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def delete(self, collection_name, id):


class BaseCollection(AbstractCollection, ABC):

URL = "collections/"
SERVICE_NAME = "api"

Expand Down
1 change: 0 additions & 1 deletion stream/personalization/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def delete(self, resource, **params):


class BasePersonalization(AbstractPersonalization, ABC):

SERVICE_NAME = "personalization"

def __init__(self, client, token):
Expand Down
1 change: 0 additions & 1 deletion stream/reactions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def filter(self, **params):


class BaseReactions(AbstractReactions, ABC):

API_ENDPOINT = "reaction/"
SERVICE_NAME = "api"

Expand Down
18 changes: 9 additions & 9 deletions stream/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import asyncio
import os
import sys
import pytest_asyncio
from uuid import uuid4

import pytest

from stream import connect

Expand All @@ -17,15 +17,15 @@ async def _parse_response(*args, **kwargs):
return _parse_response


@pytest.fixture(scope="module")
@pytest_asyncio.fixture(scope="module")
def event_loop():
"""Create an instance of the default event loop for each test case."""
loop = asyncio.get_event_loop_policy().new_event_loop()
yield loop
loop.close()


@pytest.fixture
@pytest_asyncio.fixture
async def async_client():
key = os.getenv("STREAM_KEY")
secret = os.getenv("STREAM_SECRET")
Expand All @@ -44,31 +44,31 @@ async def async_client():
yield client


@pytest.fixture
@pytest_asyncio.fixture
def user1(async_client):
return async_client.feed("user", f"1-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def user2(async_client):
return async_client.feed("user", f"2-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def aggregated2(async_client):
return async_client.feed("aggregated", f"2-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def aggregated3(async_client):
return async_client.feed("aggregated", f"3-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def topic(async_client):
return async_client.feed("topic", f"1-{uuid4()}")


@pytest.fixture
@pytest_asyncio.fixture
def flat3(async_client):
return async_client.feed("flat", f"3-{uuid4()}")
1 change: 0 additions & 1 deletion stream/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,6 @@ def test_activity_partial_update(self):
self.assertEqual(updated, expected)

def test_activities_partial_update(self):

feed = self.c.feed("user", uuid4())
feed.add_activities(
[
Expand Down
1 change: 0 additions & 1 deletion stream/users/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def delete(self, user_id):


class BaseUsers(AbstractUsers, ABC):

API_ENDPOINT = "user/"
SERVICE_NAME = "api"

Expand Down

0 comments on commit cfacbbc

Please sign in to comment.