-
Notifications
You must be signed in to change notification settings - Fork 30
Conversation
…ified website for client, else throws IntegrityError.
…oving the debugging messages. drop_all before create_all could be a good idea in fixtures.
[nosetests] | ||
match=^test | ||
nocapture=1 | ||
cover-package=lastuser_core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should cover all three blueprints.
from lastuser_core.models import * | ||
|
||
def make_fixtures(): | ||
user1 = User(username=u"user1", fullname=u"User 1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8 compliance required. Indentation is four spaces. Install SublimeLinter and drop these exceptions to PEP8 in SublimeLinter.sublime-settings
(Sublime Text -> Preferences -> Package Settings -> SublimeLinter -> Settings - User):
{
"pep8_ignore":
[
"E501",
"E128",
"E123",
"E124"
]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do this. Thanks. Have been lately facing lots of issues with indentation.
org.owners.users.append(user1) | ||
db.session.add(org) | ||
|
||
client = Client(title=u"Test Application", org=org, user=user1, website=u"http://example.com") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clients can belong to an org or a user, not both. This operation should fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't fail because of this:
https://github.com/hasgeek/lastuser/blob/master/lastuser_core/models/client.py#L61
org.owners.users.append(user1) | ||
db.session.add(org) | ||
|
||
client = Client(title=u"Test Application", org=org, user=user1, website=u"http://example.com") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it doesn't fail because SQL doesn't allow one to apply this OR that
constraints across fields. This has to be enforced by the model itself via column validators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: SQL does have the CHECK
constraint for just this purpose. We now use it extensively in Lastuser.
Testing environment bootstrapping
Not sure if I am going on the correct path. Please review and give me feedback.
@kracekumar @jace