Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Add a test for anon hitting unclaimed package
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jan 24, 2017
1 parent 6ef325e commit 791ba00
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gratipay/testing/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ def make_team(self, *a, **kw):
return team


def make_package(self, package_manager, name, description, emails):
"""Factory for teams `.
"""
self.db.one( 'INSERT INTO packages (package_manager, name, description, emails) '
'VALUES (%s, %s, %s, %s) RETURNING *'
, (package_manager, name, description, emails)
)


def make_participant(self, username, **kw):
"""Factory for :py:class:`~gratipay.models.participant.Participant`.
"""
Expand Down
13 changes: 13 additions & 0 deletions tests/py/test_www_npm_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals

from gratipay.testing import Harness


class TestAnon(Harness):

def setUp(self):
self.make_package('npm', 'foo', 'The foo package', ['[email protected]'])

def test_gets_signin_page(self):
assert 'npm/foo has not been claimed' in self.client.GET('/on/npm/foo/').body

0 comments on commit 791ba00

Please sign in to comment.