Skip to content
Browse files

Update tests, add the favicon to the list ui

  • Loading branch information...
1 parent 9a36b10 commit 3aca3243c6bf3fc6d3bc0c2d72f7da10cc478522 @mitechie committed Jun 25, 2012
View
10 Makefile
@@ -139,6 +139,16 @@ mysql_test:
bin/alembic -c test_alembic_mysql.ini upgrade head
BOOKIE_TEST_INI=test_mysql.ini $(NOSE) -xv --with-coverage --cover-package=bookie --cover-erase --with-xunit bookie/tests
+.PHONY: pgsql_test
+pgsql_test:
+ #$(PIP_MIR) $(PIP) install PyMySQL
+ #mysql -u jenkins_bookie --password=bookie -e "DROP DATABASE jenkins_bookie;"
+ #mysql -u jenkins_bookie --password=bookie -e "CREATE DATABASE jenkins_bookie;"
+ bin/alembic -c test_alembic_pgsql.ini upgrade head
+ BOOKIE_TEST_INI=test_pgsql.ini $(NOSE) -xv --with-coverage --cover-package=bookie --cover-erase --with-xunit bookie/tests
+
+
+
.PHONY: jstestserver
jstestserver:
cd bookie/static/js && $(WD)/$(PY) -m SimpleHTTPServer 9000
View
1 bookie/models/__init__.py
@@ -30,7 +30,6 @@
from sqlalchemy.orm import Query
from sqlalchemy.orm.exc import NoResultFound
-from sqlalchemy.orm.interfaces import MapperExtension
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.sql import func
from sqlalchemy.sql import and_
View
4 bookie/static/css/base.scss
@@ -384,6 +384,10 @@ fieldset {
}
}
+ .description * {
+ vertical-align: middle;
+ }
+
.tags {
float: right;
}
View
8 bookie/static/js/bookie/model.js
@@ -249,6 +249,14 @@ YUI.add('bookie-model', function (Y) {
value: ''
},
+ 'domain': {
+ getter: function () {
+ var url = this.get('url');
+ var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0];
+ return domain;
+ }
+ },
+
/**
* @attribute hash_id
* @default undefined
View
1 bookie/templates/jstpl.mako
@@ -8,6 +8,7 @@
<div class="description">
<a href="/redirect/{{hash_id}}"
title="{{extended}}">
+ <img class="favicon" src="http://s2.googleusercontent.com/s2/favicons?domain={{domain}}" />
{{#if description}}
{{description}}
{{else}}
View
2 bookie/tests/factory.py
@@ -26,6 +26,6 @@ def random_string(length=None):
def make_tag(name=None):
if not name:
- name = random_string()
+ name = random_string(255)
return Tag(name)
View
15 bookie/tests/test_api/test_admin.py
@@ -50,7 +50,9 @@ def test_list_inactive_users(self):
status=200)
# by default we shouldn't have any inactive users
data = json.loads(res.body)
- eq_(0, data['count'], "Count should be 0 to start.")
+ users = [u for u in data['users']]
+ for u in users:
+ eq_(0, u['invite_ct'], "Count should be 0 to start.")
def test_invite_ct(self):
"""Test we can call and get the invite counts."""
@@ -63,8 +65,15 @@ def test_invite_ct(self):
status=200)
# we should get back tuples of username/count
data = json.loads(res.body)['users']
- ok_('admin' in data[0][0], "There should be the admin user." + res.body)
- eq_(0, data[0][1], "The admin user shouldn't have any invites." + res.body)
+ found = False
+ invite_count = None
+ for user, count in data:
+ if user == u'admin':
+ found = True
+ invite_count = count
+
+ ok_(found, "There should be the admin user." + res.body)
+ eq_(0, invite_count, "The admin user shouldn't have any invites." + res.body)
def test_set_invite_ct(self):
"""Test we can set the invite count for the user"""
View
26 dbversions/versions/5920b225d05d_load_up_to_date.py
@@ -84,20 +84,6 @@ def upgrade():
sa.PrimaryKeyConstraint('bmark_id', 'tag_id')
)
- op.create_table('bmark_readable',
- sa.Column('bid', sa.Integer(), nullable=False),
- sa.Column('hash_id', sa.Unicode(length=22), nullable=True),
- sa.Column('content', sa.UnicodeText(), nullable=True),
- sa.Column('clean_content', sa.UnicodeText(), nullable=True),
- sa.Column('imported', sa.DateTime(), nullable=True),
- sa.Column('content_type', sa.Unicode(length=255), nullable=True),
- sa.Column('status_code', sa.Integer(), nullable=True),
- sa.Column('status_message', sa.Unicode(length=255), nullable=True),
- sa.ForeignKeyConstraint(['bid'], ['bmarks.bid'], ),
- sa.ForeignKeyConstraint(['hash_id'], ['bmarks.hash_id'], ),
- sa.PrimaryKeyConstraint('bid')
- )
-
op.create_table('logging',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user', sa.Unicode(255), nullable=False),
@@ -126,6 +112,18 @@ def upgrade():
sa.Column('data', sa.Integer),
sa.PrimaryKeyConstraint('id'),
)
+
+ op.create_table('bmark_readable',
+ sa.Column('bid', sa.Integer(), nullable=False, index=True),
+ sa.Column('hash_id', sa.Unicode(length=22), nullable=True),
+ sa.Column('content', sa.UnicodeText(), nullable=True),
+ sa.Column('clean_content', sa.UnicodeText(), nullable=True),
+ sa.Column('imported', sa.DateTime(), nullable=True),
+ sa.Column('content_type', sa.Unicode(length=255), nullable=True),
+ sa.Column('status_code', sa.Integer(), nullable=True),
+ sa.Column('status_message', sa.Unicode(length=255), nullable=True),
+ sa.PrimaryKeyConstraint('bid')
+ )
### end Alembic commands ###
View
37 test_alembic_pgsql.ini
@@ -0,0 +1,37 @@
+[alembic]
+script_location = dbversions
+app.ini = test_pgsql.ini
+
+[loggers]
+keys = root,sqlalchemy,alembic
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+qualname =
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+
+[logger_alembic]
+level = INFO
+handlers =
+qualname = alembic
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
View
78 test_pgsql.ini
@@ -0,0 +1,78 @@
+[app:main]
+use = egg:bookie
+pyramid.reload_templates = true
+pyramid.debug_authorization = false
+pyramid.debug_notfound = false
+pyramid.debug_routematch = false
+pyramid.debug_templates = false
+pyramid.default_locale_name = en
+pyramid.includes = pyramid_tm
+
+mako.directories = bookie:templates
+sqlalchemy.url = postgresql://jenkins_bookie:bookie@127.0.0.1:5432/jenkins_bookie
+
+auth.secret=supersecretthing_changeme
+
+email.enable=false
+email.from=rharding@mitechie.com
+email.host=sendmail
+
+fulltext.engine=whoosh
+fulltext.index=bookie_pgsql
+
+combo_server=127.0.0.1:8000
+# set this to help bust the cache. It will add a prefix to the combo url you
+# can url-rewrite out on the server side. Left empty for development use.
+combo_cache_id=
+
+# file to include on each page that includes things such as google analytics code
+installspecific =
+
+# Where are we going to upload import files while we wait to process them
+# we leave this commented out in tests, just let it use the default tmp dir
+#import_files=%(here)s/data/imports
+
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 6543
+
+# Begin logging configuration
+
+[loggers]
+keys = root, bookie, sqlalchemy
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = DEBUG
+handlers = console
+
+[logger_bookie]
+level = DEBUG
+handlers =
+qualname = bookie
+
+[logger_sqlalchemy]
+level = DEBUG
+handlers = console
+qualname = sqlalchemy.engine
+# "level = INFO" logs SQL queries.
+# "level = DEBUG" logs SQL queries and results.
+# "level = WARN" logs neither. (Recommended for production systems.)
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = DEBUG
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+
+# End logging configuration

0 comments on commit 3aca324

Please sign in to comment.
Something went wrong with that request. Please try again.