Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Added travis.
Browse files Browse the repository at this point in the history
Fix test try1.

Fix test try2.

Fix test try3.

Added build status.

Edited readme.
  • Loading branch information
realazizk committed May 6, 2017
1 parent ce1a435 commit 098851c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -7,5 +7,8 @@ python:
- 3.5
- 3.6
install: pip install -r requirements/dev.txt
before_script: flask lint
before_script:
- export FLASK_APP="$TRAVIS_BUILD_DIR/autoapp.py"
- export FLASK_DEBUG=1

script: flask test
5 changes: 5 additions & 0 deletions README.rst
Expand Up @@ -2,6 +2,11 @@
Real World FLask
===============================

build status

.. image:: https://travis-ci.org/mohamed-aziz/simplegen.png


.. image:: image.png


Expand Down
2 changes: 1 addition & 1 deletion conduit/articles/views.py
Expand Up @@ -70,7 +70,7 @@ def update_article(slug, **kwargs):
article = Article.query.filter_by(slug=slug, author_id=current_identity.profile.id).first()
if not article:
raise InvalidUsage(**ARTICLE_NOT_FOUND)
article.update(**kwargs, updatedAt=dt.datetime.utcnow)
article.update(updatedAt=dt.datetime.utcnow, **kwargs)
article.save()
return article

Expand Down
4 changes: 2 additions & 2 deletions conduit/user/serializers.py
Expand Up @@ -16,9 +16,9 @@ class UserSchema(Schema):
@pre_load
def make_user(self, data):
data = data['user']
if data['email'] == '':
if data.get('email') == '':
del data['email']
if data['image'] == '':
if data.get('image') == '':
del data['image']
return data

Expand Down
3 changes: 0 additions & 3 deletions requirements/prod.txt
@@ -1,7 +1,6 @@
# Everything needed in production

Werkzeug==0.12.1
Flask_Migrate==2.0.3
SQLAlchemy==1.1.9
Flask_Caching==1.2.0
Flask_SQLAlchemy==2.2
Expand All @@ -11,8 +10,6 @@ Flask_Bcrypt==0.7.1
Flask_JWT==0.3.2
flask_apispec==0.3.2
Flask==0.12.1
pytest==3.0.6
WebTest==2.0.25
PyJWT==1.5.0
unicode_slugify==0.1.3
psycopg2==2.6.2
Expand Down
8 changes: 4 additions & 4 deletions tests/test_articles.py
Expand Up @@ -12,7 +12,7 @@ def test_get_articles_by_author(self, testapp, user):
'password': 'myprecious'
}})

token = resp.json['user']['token']
token = str(resp.json['user']['token'])
for _ in range(2):
testapp.post_json(url_for('articles.make_article'), {
"article": {
Expand All @@ -35,7 +35,7 @@ def test_favorite_an_article(self, testapp, user):
'password': 'myprecious'
}})

token = resp.json['user']['token']
token = str(resp.json['user']['token'])
resp1 = testapp.post_json(url_for('articles.make_article'), {
"article": {
"title": "How to train your dragon",
Expand All @@ -58,7 +58,7 @@ def test_get_articles_by_favoriter(self, testapp, user):
'password': 'myprecious'
}})

token = resp.json['user']['token']
token = str(resp.json['user']['token'])
for _ in range(2):
testapp.post_json(url_for('articles.make_article'), {
"article": {
Expand All @@ -81,7 +81,7 @@ def test_make_article(self, testapp, user):
'password': 'myprecious'
}})

token = resp.json['user']['token']
token = str(resp.json['user']['token'])
resp = testapp.post_json(url_for('articles.make_article'), {
"article": {
"title": "How to train your dragon",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_authentication.py
Expand Up @@ -34,7 +34,7 @@ def test_user_login(self, testapp):

def test_get_user(self, testapp):
resp = _register_user(testapp)
token = resp.json['user']['token']
token = str(resp.json['user']['token'])
resp = testapp.get(url_for('user.get_user'), headers={
'Authorization': 'Token %s' % token
})
Expand All @@ -49,7 +49,7 @@ def test_register_already_registered_user(self, testapp):

def test_update_user(self, testapp):
resp = _register_user(testapp)
token = resp.json['user']['token']
token = str(resp.json['user']['token'])
resp = testapp.put_json(url_for('user.update_user'), {
'user': {
'email': 'meh@mo.mo',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_profile.py
Expand Up @@ -29,7 +29,7 @@ def test_get_profile_not_existing(self, testapp):
def test_follow_user(self, testapp, user):
user = user.get()
resp = _register_user(testapp)
token = resp.json['user']['token']
token = str(resp.json['user']['token'])
resp = testapp.post(url_for('profiles.follow_user', username=user.username), headers={
'Authorization': 'Token %s' % token
})
Expand All @@ -38,7 +38,7 @@ def test_follow_user(self, testapp, user):
def test_unfollow_user(self, testapp, user):
user = user.get()
resp = _register_user(testapp)
token = resp.json['user']['token']
token = str(resp.json['user']['token'])
resp = testapp.delete(url_for('profiles.unfollow_user', username=user.username), headers={
'Authorization': 'Token %s' % token
})
Expand Down

0 comments on commit 098851c

Please sign in to comment.