Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Fix #130 - Fix on Tests.
Browse files Browse the repository at this point in the history
   . Move session tests from test_models to test_session.
   . Re-write valid/unvalid IP Address session tests.
  • Loading branch information
philippe VESSIERE committed Jul 21, 2016
1 parent b5b7ea9 commit 507b0db
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 47 deletions.
31 changes: 1 addition & 30 deletions ban/tests/auth/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import pytest

from ban.auth import models
from ban.tests.factories import UserFactory, ClientFactory
from ban.tests.factories import UserFactory


def test_user_password_is_hashed():
Expand All @@ -12,30 +10,3 @@ def test_user_password_is_hashed():
user = models.User.get(models.User.id == user.id)
assert user.password != password
assert user.check_password(password)


def test_session_can_be_created_with_a_user():
user = UserFactory()
session = models.Session.create(user=user)
assert session.user == user
assert session.as_relation == {
'id': session.pk,
'user': user.username,
'client': None
}


def test_session_can_be_created_with_a_client():
client = ClientFactory()
session = models.Session.create(client=client)
assert session.client == client
assert session.as_relation == {
'id': session.pk,
'user': None,
'client': client.name
}


def test_session_should_have_either_a_client_or_a_user():
with pytest.raises(ValueError):
models.Session.create()
17 changes: 0 additions & 17 deletions ban/tests/http/test_session.py

This file was deleted.

0 comments on commit 507b0db

Please sign in to comment.