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

Commit

Permalink
Merge pull request #4308 from gratipay/project/claim-packages-signin
Browse files Browse the repository at this point in the history
Add a test for anon hitting unclaimed package
  • Loading branch information
mattbk authored Jan 25, 2017
2 parents df82de1 + dd88bc5 commit 3d6542d
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 packages.
"""
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 3d6542d

Please sign in to comment.