From 9c052766cd54a80c3885808d0c2e5e0aeb9afd1f Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Tue, 7 Feb 2017 20:45:42 -0500 Subject: [PATCH] Use constant instead of string literal for 'npm' --- gratipay/models/package/__init__.py | 4 ++++ tests/py/test_packages.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gratipay/models/package/__init__.py b/gratipay/models/package/__init__.py index 64eda95ba7..24af56d724 100644 --- a/gratipay/models/package/__init__.py +++ b/gratipay/models/package/__init__.py @@ -4,6 +4,10 @@ from postgres.orm import Model +NPM = 'npm' # We are starting with a single package manager. If we see + # traction we will expand. + + class Package(Model): """Represent a gratipackage. :-) """ diff --git a/tests/py/test_packages.py b/tests/py/test_packages.py index a479070c8b..b97e888377 100644 --- a/tests/py/test_packages.py +++ b/tests/py/test_packages.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from gratipay.models.package import Package +from gratipay.models.package import NPM, Package from gratipay.testing import Harness @@ -13,4 +13,4 @@ def test_can_be_instantiated_from_id(self): def test_can_be_instantiated_from_names(self): self.make_package() - assert Package.from_names('npm', 'foo').name == 'foo' + assert Package.from_names(NPM, 'foo').name == 'foo'