Browse files

Merge pull request #22 from klrmn/pep8

Pep8.  Looks great!  thanks for doing this!!
  • Loading branch information...
2 parents 99e61d5 + fcc0885 commit ab95db20d32eb21e57630615b10b926b659c334e @camd camd committed Feb 20, 2013
Showing with 255 additions and 214 deletions.
  1. +4 −1 moztrap/deploy/paths.py
  2. +3 −2 moztrap/deploy/vendor_wsgi.py
  3. +4 −2 moztrap/deploy/wsgi.py
  4. +2 −2 moztrap/model/attachments/migrations/0001_initial.py
  5. +2 −2 moztrap/model/core/api.py
  6. +1 −0 moztrap/model/core/fixture_gen.py
  7. +2 −2 moztrap/model/core/management/commands/create_default_roles.py
  8. +0 −1 moztrap/model/core/management/commands/import.py
  9. +3 −2 moztrap/model/core/migrations/0001_initial.py
  10. +3 −2 moztrap/model/core/migrations/0002_auto__del_unique_productversion_product_version.py
  11. +3 −2 moztrap/model/core/migrations/0003_auto__add_field_productversion_cc_version__add_field_product.py
  12. +1 −0 moztrap/model/core/migrations/0004_fix_dupe_emails.py
  13. +1 −0 moztrap/model/core/migrations/0005_add_manage_products_permission_for_test_managers.py
  14. +1 −1 moztrap/model/core/migrations/0006_auto__add_apikey.py
  15. +1 −1 ...el/core/migrations/0007_auto__chg_field_productversion_modified_by__chg_field_productversion_c.py
  16. +0 −2 moztrap/model/environments/api.py
  17. +1 −0 moztrap/model/environments/fixture_gen.py
  18. +3 −2 moztrap/model/environments/migrations/0001_initial.py
  19. +3 −2 ...onments/migrations/0002_auto__add_field_profile_cc_version__add_field_element_cc_version__add_.py
  20. +1 −1 ...onments/migrations/0003_auto__chg_field_profile_modified_by__chg_field_profile_created_by__chg.py
  21. +5 −8 moztrap/model/execution/api.py
  22. +1 −0 moztrap/model/execution/fixture_gen.py
  23. +3 −2 moztrap/model/execution/migrations/0001_initial.py
  24. +3 −2 ...ecution/migrations/0002_auto__add_field_runcaseversion_cc_version__add_field_run_cc_version__a.py
  25. +1 −1 moztrap/model/execution/migrations/0003_auto.py
  26. +2 −1 moztrap/model/execution/migrations/0004_auto__chg_field_result_started.py
  27. +1 −1 moztrap/model/execution/migrations/0005_auto__add_field_result_is_latest.py
  28. +1 −1 ...rap/model/execution/migrations/0006_auto__del_field_result_started__del_field_result_completed.py
  29. +1 −1 moztrap/model/execution/migrations/0007_auto__del_field_result_reviewed_on.py
  30. +1 −1 ...ecution/migrations/0008_auto__chg_field_runcaseversion_modified_by__chg_field_runcaseversion_d.py
  31. +1 −1 ...ecution/migrations/0009_auto__add_field_run_build__add_field_run_is_series__add_field_run_seri.py
  32. +1 −1 moztrap/model/execution/migrations/0010_auto.py
  33. +1 −3 moztrap/model/execution/models.py
  34. +23 −2 moztrap/model/library/api.py
  35. +2 −0 moztrap/model/library/bulk.py
  36. +1 −0 moztrap/model/library/fixture_gen.py
  37. +1 −1 moztrap/model/library/importer.py
  38. +3 −2 moztrap/model/library/migrations/0001_initial.py
  39. +3 −2 ...library/migrations/0002_auto__del_unique_suitecase_case_suite__del_unique_caseversion_case_pro.py
  40. +3 −2 ...library/migrations/0003_auto__add_field_suite_cc_version__add_field_suitecase_cc_version__add_.py
  41. +1 −1 moztrap/model/library/migrations/0004_auto__add_field_caseattachment_name.py
  42. +1 −1 moztrap/model/library/migrations/0005_auto__add_field_case_idprefix.py
  43. +1 −1 ...library/migrations/0006_auto__chg_field_suite_modified_by__chg_field_suite_created_by__chg_fie.py
  44. +1 −1 moztrap/model/library/migrations/0007_auto__chg_field_caseversion_name.py
  45. +1 −1 moztrap/model/migrations/preferences/0001_initial.py
  46. +9 −8 moztrap/model/mtapi.py
  47. +2 −2 moztrap/model/mtmodel.py
  48. +1 −2 moztrap/model/tags/api.py
  49. +1 −0 moztrap/model/tags/fixture_gen.py
  50. +3 −2 moztrap/model/tags/migrations/0001_initial.py
  51. +3 −2 moztrap/model/tags/migrations/0002_auto__del_unique_tag_name.py
  52. +3 −2 moztrap/model/tags/migrations/0003_auto__add_field_tag_cc_version.py
  53. +1 −1 ...el/tags/migrations/0004_auto__chg_field_tag_modified_by__chg_field_tag_created_by__chg_field_t.py
  54. +1 −1 moztrap/model/tags/migrations/0005_auto__add_field_tag_description.py
  55. +3 −3 moztrap/settings/base.py
  56. +2 −3 moztrap/settings/default.py
  57. +1 −0 moztrap/view/lists/cases.py
  58. +2 −0 moztrap/view/lists/filters.py
  59. +4 −4 moztrap/view/lists/pagination.py
  60. +1 −1 moztrap/view/lists/sort.py
  61. +0 −2 moztrap/view/lists/templatetags/filters.py
  62. +2 −4 moztrap/view/manage/cases/forms.py
  63. +2 −2 moztrap/view/manage/environments/decorators.py
  64. +2 −2 moztrap/view/manage/environments/views.py
  65. +1 −1 moztrap/view/manage/runs/forms.py
  66. +2 −2 moztrap/view/manage/tags/views.py
  67. +1 −1 moztrap/view/runtests/views.py
  68. +1 −1 moztrap/view/templatetags/site.py
  69. +1 −1 moztrap/view/users/forms.py
  70. +2 −1 moztrap/view/utils/mtforms.py
  71. +3 −3 tests/case/api/base.py
  72. +8 −8 tests/model/core/api/test_product_resource.py
  73. +5 −5 tests/model/core/api/test_productversion_env_resource.py
  74. +1 −1 tests/model/core/api/test_productversion_resource.py
  75. +0 −1 tests/model/core/models/test_user.py
  76. +5 −5 tests/model/environments/api/test_category_resource.py
  77. +5 −5 tests/model/environments/api/test_element_resource.py
  78. +5 −5 tests/model/environments/api/test_environment_resource.py
  79. +8 −8 tests/model/execution/api/test_result.py
  80. +5 −8 tests/model/execution/api/test_run.py
  81. +6 −6 tests/model/execution/api/test_runcaseversion.py
  82. +1 −1 tests/model/execution/models/test_result.py
  83. +7 −5 tests/model/execution/models/test_run.py
  84. +1 −1 tests/model/execution/models/test_runcaseversion.py
  85. +1 −1 tests/model/library/api/test_case_resource.py
  86. +3 −3 tests/model/library/api/test_caseversion_resource.py
  87. +8 −8 tests/model/library/api/test_suite_resource.py
  88. +2 −2 tests/model/library/test_bulk.py
  89. +3 −2 tests/model/library/test_importer.py
  90. +10 −10 tests/model/tags/api/test_tags_resource.py
  91. +1 −0 tests/model/test_mtadmin.py
  92. +2 −0 tests/view/lists/test_actions.py
  93. +2 −2 tests/view/lists/test_filters.py
  94. +1 −1 tests/view/lists/test_sort.py
  95. +5 −5 tests/view/manage/cases/test_forms.py
  96. +1 −1 tests/view/manage/tags/test_forms.py
  97. +0 −2 tests/view/runtests/templatetags/test_execution.py
  98. +1 −1 tests/view/runtests/test_forms.py
  99. +1 −1 tests/view/users/test_views.py
  100. +1 −1 tests/view/utils/test_mtforms.py
View
5 moztrap/deploy/paths.py
@@ -2,7 +2,10 @@
Utility functions for deployment-related path-munging.
"""
-import os, sys, site
+
+import os
+import sys
+import site
def add_vendor_lib():
View
5 moztrap/deploy/vendor_wsgi.py
@@ -1,9 +1,10 @@
-"""
+"""
Alternative WSGI entry-point that uses requirements/vendor for
dependencies.
"""
-import os, sys
+import os
+import sys
base_dir = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
View
6 moztrap/deploy/wsgi.py
@@ -1,5 +1,7 @@
-"WSGI entry-point for MozTrap."""
-import os, sys
+"""WSGI entry-point for MozTrap."""
+
+import os
+import sys
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, base_dir)
View
4 moztrap/model/attachments/migrations/0001_initial.py
@@ -14,7 +14,7 @@ def backwards(self, orm):
pass
models = {
-
+
}
- complete_apps = ['attachments']
+ complete_apps = ['attachments']
View
4 moztrap/model/core/api.py
@@ -11,6 +11,7 @@
import logging
logger = logging.getLogger(__name__)
+
class ReportResultsAuthorization(MTAuthorization):
"""Authorization that only allows users with execute privileges."""
@@ -131,7 +132,7 @@ def obj_update(self, bundle, request=None, **kwargs):
productversions = bundle.data.pop("productversions", [])
bundle.data["productversions"] = []
- updated_bundle = super(ProductResource, self).obj_update(
+ updated_bundle = super(ProductResource, self).obj_update(
bundle=bundle, request=request, **kwargs)
# create the productversions
@@ -166,4 +167,3 @@ class Meta:
queryset = User.objects.all()
list_allowed_methods = ['get']
fields = ["id", "username"]
-
View
1 moztrap/model/core/fixture_gen.py
@@ -11,6 +11,7 @@
from .models import Product, ProductVersion
+
@fixture_generator(
Product, ProductVersion, requires=[
"environments.sample_environments", "core.sample_users"])
View
4 moztrap/model/core/management/commands/create_default_roles.py
@@ -50,7 +50,7 @@ def handle_noargs(self, **options):
if not created:
if verbosity:
print("Role %r already exists; skipping." % role_name)
- continue # pragma: no cover http://bugs.python.org/issue2506
+ continue # pragma: no cover http://bugs.python.org/issue2506
if verbosity:
print("Role %r created." % role_name)
@@ -64,7 +64,7 @@ def handle_noargs(self, **options):
except Permission.DoesNotExist:
if verbosity:
print(" Permission %r unknown; skipping." % perm_label)
- continue # pragma: no cover http://bugs.python.org/issue2506
+ continue # pragma: no cover http://bugs.python.org/issue2506
role.permissions.add(perm)
View
1 moztrap/model/core/management/commands/import.py
@@ -128,4 +128,3 @@ def handle(self, *args, **options):
'Could not open "{0}", I/O error {1}: {2}'.format(
args[2], errno, strerror)
)
-
View
5 moztrap/model/core/migrations/0001_initial.py
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding model 'Product'
db.create_table('core_product', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -70,7 +71,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Removing unique constraint on 'ProductVersion', fields ['product', 'version']
db.delete_unique('core_productversion', ['product_id', 'version'])
View
5 moztrap/model/core/migrations/0002_auto__del_unique_productversion_product_version.py
@@ -4,16 +4,17 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Removing unique constraint on 'ProductVersion', fields ['product', 'version']
db.delete_unique('core_productversion', ['product_id', 'version'])
def backwards(self, orm):
-
+
# Adding unique constraint on 'ProductVersion', fields ['product', 'version']
db.create_unique('core_productversion', ['product_id', 'version'])
View
5 ...odel/core/migrations/0003_auto__add_field_productversion_cc_version__add_field_product.py
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding field 'ProductVersion.cc_version'
db.add_column('core_productversion', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
@@ -16,7 +17,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Deleting field 'ProductVersion.cc_version'
db.delete_column('core_productversion', 'cc_version')
View
1 moztrap/model/core/migrations/0004_fix_dupe_emails.py
@@ -4,6 +4,7 @@
from south.v2 import DataMigration
from django.db import models
+
class Migration(DataMigration):
def forwards(self, orm):
View
1 moztrap/model/core/migrations/0005_add_manage_products_permission_for_test_managers.py
@@ -5,6 +5,7 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
+
class Migration(DataMigration):
def forwards(self, orm):
View
2 moztrap/model/core/migrations/0006_auto__add_apikey.py
@@ -165,4 +165,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['core']
+ complete_apps = ['core']
View
2 ...migrations/0007_auto__chg_field_productversion_modified_by__chg_field_productversion_c.py
@@ -150,4 +150,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['core']
+ complete_apps = ['core']
View
2 moztrap/model/environments/api.py
@@ -36,5 +36,3 @@ class Meta:
list_allowed_methods = ['get']
fields = ["id"]
filtering = {"elements": ALL}
-
-
View
1 moztrap/model/environments/fixture_gen.py
@@ -6,6 +6,7 @@
from ..core.auth import User
from .models import Profile, Environment, Element, Category
+
@fixture_generator(
Profile, Category, Element, Environment, requires=["core.sample_users"])
def sample_environments():
View
5 moztrap/model/environments/migrations/0001_initial.py
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding model 'Profile'
db.create_table('environments_profile', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -71,7 +72,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Deleting model 'Profile'
db.delete_table('environments_profile')
View
5 ...migrations/0002_auto__add_field_profile_cc_version__add_field_element_cc_version__add_.py
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding field 'Profile.cc_version'
db.add_column('environments_profile', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
@@ -22,7 +23,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Deleting field 'Profile.cc_version'
db.delete_column('environments_profile', 'cc_version')
View
2 ...migrations/0003_auto__chg_field_profile_modified_by__chg_field_profile_created_by__chg.py
@@ -102,4 +102,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['environments']
+ complete_apps = ['environments']
View
13 moztrap/model/execution/api.py
@@ -99,14 +99,14 @@ def dehydrate(self, bundle):
def dispatch_detail(self, request, **kwargs):
"""For details, we want the full info on environments for the run """
- self.fields["environments"].full=True
+ self.fields["environments"].full = True
return super(RunResource, self).dispatch_detail(request, **kwargs)
def dispatch_list(self, request, **kwargs):
"""For list, we don't want the full info on environments """
- self.fields["environments"].full=False
+ self.fields["environments"].full = False
return super(RunResource, self).dispatch_list(request, **kwargs)
@@ -258,9 +258,9 @@ def obj_create(self, bundle, request=None, **kwargs):
try:
status = data.pop("status")
- case=data.pop("case")
+ case = data.pop("case")
env = Environment.objects.get(pk=data.get("environment"))
- run=data.pop("run_id")
+ run = data.pop("run_id")
except KeyError as e:
raise ValidationError(
@@ -326,7 +326,7 @@ def dehydrate(self, bundle):
bundle.data["filter_cases"] = filter_url("manage_cases", suite)
if "runs" in bundle.request.GET.keys():
- run_id=int(bundle.request.GET["runs"])
+ run_id = int(bundle.request.GET["runs"])
s = suite.runsuites.all()
order = [x.order for x in suite.runsuites.all()
if x.run_id == run_id][0]
@@ -335,6 +335,3 @@ def dehydrate(self, bundle):
bundle.data["order"] = None
return bundle
-
-
-
View
1 moztrap/model/execution/fixture_gen.py
@@ -7,6 +7,7 @@
from .models import Run, RunSuite, RunCaseVersion
+
@fixture_generator(
Run, RunSuite, RunCaseVersion, requires=[
"library.sample_suites", "core.sample_users", "core.sample_products"])
View
5 moztrap/model/execution/migrations/0001_initial.py
@@ -4,6 +4,7 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
depends_on = [
@@ -13,7 +14,7 @@ class Migration(SchemaMigration):
]
def forwards(self, orm):
-
+
# Adding model 'Run'
db.create_table('execution_run', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -127,7 +128,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Deleting model 'Run'
db.delete_table('execution_run')
View
5 ...migrations/0002_auto__add_field_runcaseversion_cc_version__add_field_run_cc_version__a.py
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding field 'RunCaseVersion.cc_version'
db.add_column('execution_runcaseversion', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
@@ -25,7 +26,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Deleting field 'RunCaseVersion.cc_version'
db.delete_column('execution_runcaseversion', 'cc_version')
View
2 moztrap/model/execution/migrations/0003_auto.py
@@ -321,4 +321,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
3 moztrap/model/execution/migrations/0004_auto__chg_field_result_started.py
@@ -11,6 +11,7 @@ def forwards(self, orm):
# Changing field 'Result.started'
db.alter_column('execution_result', 'started', self.gf('django.db.models.fields.DateTimeField')(null=True))
+
def backwards(self, orm):
# Changing field 'Result.started'
@@ -316,4 +317,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
2 moztrap/model/execution/migrations/0005_auto__add_field_result_is_latest.py
@@ -320,4 +320,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
2 ...l/execution/migrations/0006_auto__del_field_result_started__del_field_result_completed.py
@@ -326,4 +326,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
2 moztrap/model/execution/migrations/0007_auto__del_field_result_reviewed_on.py
@@ -317,4 +317,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
2 ...migrations/0008_auto__chg_field_runcaseversion_modified_by__chg_field_runcaseversion_d.py
@@ -314,4 +314,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
2 ...migrations/0009_auto__add_field_run_build__add_field_run_is_series__add_field_run_seri.py
@@ -338,4 +338,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
2 moztrap/model/execution/migrations/0010_auto.py
@@ -324,4 +324,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['execution']
+ complete_apps = ['execution']
View
4 moztrap/model/execution/models.py
@@ -534,7 +534,7 @@ def set_latest(self):
is_latest=True,
).exclude(pk=self.pk).update(is_latest=False)
- self.is_latest=True
+ self.is_latest = True
@@ -576,5 +576,3 @@ def result_summary(results):
cursor.execute(sql, states)
return dict(zip(states, cursor.fetchone()))
-
-
View
25 moztrap/model/library/api.py
@@ -26,8 +26,8 @@ def permission(self):
class CaseVersionAuthorization(MTAuthorization):
- """A permission of 'core.manage_productversions does not exist,
- use core.manage_products instead."""
+ """A permission of 'library.manage_caseversions does not exist,
+ use library.manage_cases instead."""
@property
def permission(self):
@@ -62,6 +62,12 @@ def model(self):
class CaseResource(MTResource):
+ """
+ Create, Read, Update and Delete capabilities for Case.
+
+ Filterable by suites and product fields.
+ """
+
suites = fields.ToManyField(SuiteResource, "suites", readonly=True)
product = fields.ForeignKey(ProductResource, "product")
@@ -97,6 +103,11 @@ def hydrate_product(self, bundle):
class CaseStepResource(MTResource):
+ """
+ Create, Read, Update and Delete capabilities for CaseSteps.
+
+ Filterable by caseversion field.
+ """
caseversion = fields.ForeignKey(
"moztrap.model.library.api.CaseVersionResource", "caseversion")
@@ -141,6 +152,11 @@ def hydrate_caseversion(self, bundle):
class SuiteCaseResource(MTResource):
+ """
+ Create, Read, Update and Delete capabilities for SuiteCase.
+
+ Filterable by suite and case fields.
+ """
case = fields.ForeignKey(CaseResource, 'case')
suite = fields.ForeignKey(SuiteResource, 'suite')
@@ -224,6 +240,11 @@ def hydrate_suite(self, bundle):
class CaseVersionResource(MTResource):
+ """
+ Create, Read, Update and Delete capabilities for CaseVersions.
+
+ Filterable by environments, productversion, case, and tags fields.
+ """
case = fields.ForeignKey(CaseResource, "case")
steps = fields.ToManyField(
View
2 moztrap/model/library/bulk.py
@@ -2,6 +2,8 @@
Parser for text format for bulk test case entry.
"""
+
+
class ParsingError(Exception):
pass
View
1 moztrap/model/library/fixture_gen.py
@@ -8,6 +8,7 @@
from .models import (
Case, CaseVersion, Suite, SuiteCase, CaseStep, CaseAttachment)
+
@fixture_generator(
Case, CaseVersion, CaseStep, CaseAttachment,
requires=["core.sample_products", "tags.sample_tags", "core.sample_users"])
View
2 moztrap/model/library/importer.py
@@ -273,7 +273,7 @@ def import_steps(self, caseversion, step_data):
try:
casestep = CaseStep.objects.create(
caseversion=caseversion,
- number=step_num+1,
+ number=step_num + 1,
instruction=new_step["instruction"],
expected=new_step.get("expected", ""),
)
View
5 moztrap/model/library/migrations/0001_initial.py
@@ -4,6 +4,7 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
depends_on = [
@@ -13,7 +14,7 @@ class Migration(SchemaMigration):
]
def forwards(self, orm):
-
+
# Adding model 'Case'
db.create_table('library_case', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -134,7 +135,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Removing unique constraint on 'SuiteCase', fields ['suite', 'case']
db.delete_unique('library_suitecase', ['suite_id', 'case_id'])
View
5 ...migrations/0002_auto__del_unique_suitecase_case_suite__del_unique_caseversion_case_pro.py
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Removing unique constraint on 'CaseStep', fields ['caseversion', 'number']
db.delete_unique('library_casestep', ['caseversion_id', 'number'])
@@ -19,7 +20,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Adding unique constraint on 'SuiteCase', fields ['case', 'suite']
db.create_unique('library_suitecase', ['case_id', 'suite_id'])
View
5 ...migrations/0003_auto__add_field_suite_cc_version__add_field_suitecase_cc_version__add_.py
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding field 'Suite.cc_version'
db.add_column('library_suite', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
@@ -28,7 +29,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Deleting field 'Suite.cc_version'
db.delete_column('library_suite', 'cc_version')
View
2 moztrap/model/library/migrations/0004_auto__add_field_caseattachment_name.py
@@ -244,4 +244,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['library']
+ complete_apps = ['library']
View
2 moztrap/model/library/migrations/0005_auto__add_field_case_idprefix.py
@@ -245,4 +245,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['library']
+ complete_apps = ['library']
View
2 ...migrations/0006_auto__chg_field_suite_modified_by__chg_field_suite_created_by__chg_fie.py
@@ -242,4 +242,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['library']
+ complete_apps = ['library']
View
2 moztrap/model/library/migrations/0007_auto__chg_field_caseversion_name.py
@@ -245,4 +245,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['library']
+ complete_apps = ['library']
View
2 moztrap/model/migrations/preferences/0001_initial.py
@@ -47,4 +47,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['preferences']
+ complete_apps = ['preferences']
View
17 moztrap/model/mtapi.py
@@ -4,9 +4,10 @@
from .core.models import ApiKey
-import logging, sys, traceback
+import logging
logger = logging.getLogger("moztrap.model.mtapi")
+
class MTApiKeyAuthentication(ApiKeyAuthentication):
"""Authentication that requires our custom api key implementation."""
@@ -23,7 +24,7 @@ def get_key(self, user, api_key):
def is_authenticated(self, request, **kwargs):
"""
- Finds the user and checks their API key. GET requests are always
+ Finds the user and checks their API key. GET requests are always
allowed.
This overrides Tastypie's default impl, because we use a User
@@ -45,7 +46,7 @@ def is_authenticated(self, request, **kwargs):
logger.debug("no username") # pragma: no cover
elif not api_key: # pragma: no cover
logger.debug("no api key") # pragma: no cover
- return self._unauthorized()
+ return self._unauthorized()
try:
user = User.objects.get(username=username)
@@ -66,7 +67,7 @@ class MTAuthorization(Authorization):
def permission(self):
"""This permission should be checked by is_authorized."""
klass = self.resource_meta.object_class
- permission = "%s.manage_%ss" % (klass._meta.app_label,
+ permission = "%s.manage_%ss" % (klass._meta.app_label,
klass._meta.module_name)
logger.debug("desired permission %s" % permission)
return permission
@@ -125,7 +126,7 @@ def obj_create(self, bundle, request=None, **kwargs):
def obj_update(self, bundle, request=None, **kwargs):
"""Set the modified_by field for the object to the request's user"""
- # this try/except logging is more helpful than 500 / 404 errors on the
+ # this try/except logging is more helpful than 500 / 404 errors on the
# client side
try:
bundle = super(MTResource, self).obj_update(
@@ -138,11 +139,11 @@ def obj_update(self, bundle, request=None, **kwargs):
def obj_delete(self, request=None, **kwargs):
- """Delete the object.
+ """Delete the object.
The DELETE request may include permanent=True/False in its params
parameter (ie, along with the user's credentials). Default is False.
"""
- # this try/except logging is more helpful than 500 / 404 errors on
+ # this try/except logging is more helpful than 500 / 404 errors on
# the client side
try:
permanent = request._request.dicts[1].get("permanent", False)
@@ -157,7 +158,7 @@ def obj_delete(self, request=None, **kwargs):
def delete_detail(self, request, **kwargs):
"""Avoid the following error:
- WSGIWarning: Content-Type header found in a 204 response, which not
+ WSGIWarning: Content-Type header found in a 204 response, which not
return content.
"""
res = super(MTResource, self).delete_detail(request, **kwargs)
View
4 moztrap/model/mtmodel.py
@@ -300,13 +300,13 @@ def clone(self, cascade=None, overrides=None, user=None):
for name, filter_func in cascade.items():
mgr = getattr(self, name)
- if mgr.__class__.__name__ == "ManyRelatedManager": # M2M
+ if mgr.__class__.__name__ == "ManyRelatedManager": # M2M
clone_mgr = getattr(clone, name)
existing = set(clone_mgr.all())
new = set(filter_func(mgr.all()))
clone_mgr.add(*new.difference(existing))
clone_mgr.remove(*existing.difference(new))
- elif mgr.__class__.__name__ == "RelatedManager": # reverse FK
+ elif mgr.__class__.__name__ == "RelatedManager": # reverse FK
reverse_name = getattr(self.__class__, name).related.field.name
for obj in filter_func(mgr.all()):
obj.clone(overrides={reverse_name: clone})
View
3 moztrap/model/tags/api.py
@@ -82,7 +82,7 @@ def obj_update(self, bundle, request=None, **kwargs):
else:
logger.debug(
"product matches caseversions' product")
- else: # changing from product-specific to global
+ else: # changing from product-specific to global
logger.debug("changing from product-specific to global")
else:
logger.debug("not changing product")
@@ -93,4 +93,3 @@ def obj_update(self, bundle, request=None, **kwargs):
return super(TagResource, self).obj_update(
bundle=bundle, request=request, **kwargs)
-
View
1 moztrap/model/tags/fixture_gen.py
@@ -6,6 +6,7 @@
from .models import Tag
+
@fixture_generator(Tag, requires=["core.sample_products", "core.sample_users"])
def sample_tags():
admin = User.objects.get(username="admin")
View
5 moztrap/model/tags/migrations/0001_initial.py
@@ -4,14 +4,15 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
depends_on = [
("core", "0001_initial"),
]
def forwards(self, orm):
-
+
# Adding model 'Tag'
db.create_table('tags_tag', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -28,7 +29,7 @@ def forwards(self, orm):
def backwards(self, orm):
-
+
# Deleting model 'Tag'
db.delete_table('tags_tag')
View
5 moztrap/model/tags/migrations/0002_auto__del_unique_tag_name.py
@@ -4,16 +4,17 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Removing unique constraint on 'Tag', fields ['name']
db.delete_unique('tags_tag', ['name'])
def backwards(self, orm):
-
+
# Adding unique constraint on 'Tag', fields ['name']
db.create_unique('tags_tag', ['name'])
View
5 moztrap/model/tags/migrations/0003_auto__add_field_tag_cc_version.py
@@ -4,16 +4,17 @@
from south.v2 import SchemaMigration
from django.db import models
+
class Migration(SchemaMigration):
def forwards(self, orm):
-
+
# Adding field 'Tag.cc_version'
db.add_column('tags_tag', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
def backwards(self, orm):
-
+
# Deleting field 'Tag.cc_version'
db.delete_column('tags_tag', 'cc_version')
View
2 ...migrations/0004_auto__chg_field_tag_modified_by__chg_field_tag_created_by__chg_field_t.py
@@ -80,4 +80,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['tags']
+ complete_apps = ['tags']
View
2 moztrap/model/tags/migrations/0005_auto__add_field_tag_description.py
@@ -87,4 +87,4 @@ def backwards(self, orm):
}
}
- complete_apps = ['tags']
+ complete_apps = ['tags']
View
6 moztrap/settings/base.py
@@ -174,7 +174,7 @@
}
},
"loggers": {
- "django.request":{
+ "django.request": {
"handlers": ["mail_admins"],
"level": "ERROR",
"propagate": True,
@@ -199,7 +199,7 @@
INSTALLED_APPS += ["djangosecure"]
SESSION_COOKIE_HTTPONLY = True
-SESSION_COOKIE_AGE = 8 * 60 * 60 # 8 hours
+SESSION_COOKIE_AGE = 8 * 60 * 60 # 8 hours
SECURE_FRAME_DENY = True
MINIMUM_PASSWORD_CHARS = 8
@@ -210,7 +210,7 @@
"pass",
"123",
"test"
- ] # @@@ get full list from InfraSec
+ ] # @@@ get full list from InfraSec
ALLOW_ANONYMOUS_ACCESS = False
View
5 moztrap/settings/default.py
@@ -17,9 +17,8 @@
HMAC_KEYS = {"default": SECRET_KEY}
LOGGING["handlers"]["null"] = {
- 'level':'DEBUG',
- 'class':'django.utils.log.NullHandler',
+ 'level': 'DEBUG',
+ 'class': 'django.utils.log.NullHandler',
}
LOGGING["root"] = {"handlers": ["null"]}
-
View
1 moztrap/view/lists/cases.py
@@ -1,6 +1,7 @@
from filters import KeywordFilter
from django.db.models import Q
+
class PrefixIDFilter(KeywordFilter):
"""
A string and an int, separated by a delimiter.
View
2 moztrap/view/lists/filters.py
@@ -2,6 +2,7 @@
Utilities for filtering querysets in a view.
"""
+
from collections import namedtuple
from functools import wraps
import json
@@ -60,6 +61,7 @@ def filter(ctx_name, filters=None, filterset_class=None):
if filterset_class is None:
filterset_class = FilterSet
filterset = filterset_class(filters)
+
def decorator(view_func):
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
View
8 moztrap/view/lists/pagination.py
@@ -69,9 +69,9 @@ def display_pages(self):
Elides some ranges of page numbers with None in long lists.
"""
- MIN_SKIP = 3 # don't bother eliding just one or two pages
- FROM_CURRENT = 2 # always show two to either side of current page
- FROM_END = 2 # always show two from each end
+ MIN_SKIP = 3 # don't bother eliding just one or two pages
+ FROM_CURRENT = 2 # always show two to either side of current page
+ FROM_END = 2 # always show two from each end
skip = []
ret = []
@@ -118,7 +118,7 @@ def objects(self):
if not self.high:
self._sliced_qs = self._queryset.empty()
else:
- self._sliced_qs = self._queryset[self.low-1:self.high]
+ self._sliced_qs = self._queryset[self.low - 1:self.high]
return self._sliced_qs
View
2 moztrap/view/lists/sort.py
@@ -28,7 +28,7 @@ def _wrapped_view(request, *args, **kwargs):
ctx["sort"] = Sort(request, defaultfield, defaultdirection)
try:
sortqs = ctx[ctx_name].order_by(*ctx["sort"].order_by)
- str(sortqs.query) # hack to force evaluation of sort arguments
+ str(sortqs.query) # hack to force evaluation of sort arguments
except FieldError:
pass
else:
View
2 moztrap/view/lists/templatetags/filters.py
@@ -16,5 +16,3 @@
def filter_url(view, obj):
"""Template filter to get filtered url."""
return filters.filter_url(view, obj)
-
-
View
6 moztrap/view/manage/cases/forms.py
@@ -12,8 +12,6 @@
from ...utils import mtforms
-
-
class BaseCaseForm(mtforms.NonFieldErrorsClassFormMixin, forms.Form):
"""
Base form for all test case/version forms.
@@ -108,7 +106,7 @@ def save_attachments(self, caseversion):
delete_ids = set(self.data.getlist("remove-attachment"))
caseversion.attachments.filter(id__in=delete_ids).delete()
- if self.files: # if no files, it's a plain dict, has no getlist
+ if self.files: # if no files, it's a plain dict, has no getlist
for uf in self.files.getlist("add_attachment"):
model.CaseAttachment.objects.create(
attachment=uf,
@@ -205,7 +203,7 @@ def save(self):
case=case,
suite=suite,
user=self.user,
- order=order+1,
+ order=order + 1,
)
productversions = [version_kwargs.pop("productversion")]
View
4 moztrap/view/manage/environments/decorators.py
@@ -76,7 +76,7 @@ def _wrapped_view(request, *args, **kwargs):
"category": cat,
"selected_element_ids": set(
map(int, request.POST.getlist("elements"))),
- "name": "elements" # @@@ duplicated form field name
+ "name": "elements" # @@@ duplicated form field name
},
RequestContext(request)
)
@@ -108,7 +108,7 @@ def _wrapped_view(request, *args, **kwargs):
template_name,
{
"element": e,
- "name": "elements" # @@@ duplicated form field name
+ "name": "elements" # @@@ duplicated form field name
},
RequestContext(request))
View
4 moztrap/view/manage/environments/views.py
@@ -203,7 +203,7 @@ def element_autocomplete(request):
for e in elements:
start = e.name.lower().index(text.lower())
pre = e.name[:start]
- post = e.name[start+len(text):]
+ post = e.name[start + len(text):]
suggestions.append({
"preText": pre,
"typedText": text,
@@ -264,6 +264,6 @@ def narrow_environments(request, object_type, object_id):
{
"environments": obj.productversion.environments.all(),
"selected_env_ids": current_env_ids,
- "filters": EnvironmentFilterSet().bind(), # for JS filtering
+ "filters": EnvironmentFilterSet().bind(), # for JS filtering
"obj": obj,
})
View
2 moztrap/view/manage/runs/forms.py
@@ -81,7 +81,7 @@ def clean_suites(self):
# some of the values weren't ints, and therefore this is
# from the read-only list of suites. so return None so that we
# don't try to remove and re-add them.
- if "suites" in self.changed_data: # pragma: no cover
+ if "suites" in self.changed_data: # pragma: no cover
self.changed_data.remove("suites")
return None
View
4 moztrap/view/manage/tags/views.py
@@ -115,7 +115,7 @@ def tag_edit(request, tag_id):
{
"form": form,
"tag": tag,
- "hide_multiselect": (tag.product==None),
+ "hide_multiselect": (tag.product is None),
}
)
@@ -139,7 +139,7 @@ def tag_autocomplete(request):
# want pre and post to be case-accurate
start = tag.name.lower().index(text.lower())
pre = tag.name[:start]
- post = tag.name[start+len(text):]
+ post = tag.name[start + len(text):]
suggestions.append({
"preText": pre,
"typedText": text,
View
2 moztrap/view/runtests/views.py
@@ -196,7 +196,7 @@ def run(request, run_id, env_id):
if rcv is None:
return HttpResponse(
json.dumps({"html": "", "no_replace": True}),
- content_type = "application/json",
+ content_type="application/json",
)
# by not returning a TemplateResponse, we skip the sort and finder
# decorators, which aren't applicable to a single case.
View
2 moztrap/view/templatetags/site.py
@@ -3,9 +3,9 @@
from django.conf import settings
-
register = template.Library()
+
@register.simple_tag
def settings_value(name):
"""Return the requested setting value and place it in context under ``varname``"""
View
2 moztrap/view/users/forms.py
@@ -170,7 +170,7 @@ def __init__(self, *args, **kwargs):
# only add the captcha field if this request hit the rate limit
if getattr(self.request, "limited", False):
- a, b = random.randint(1,9), random.randint(1, 9)
+ a, b = random.randint(1, 9), random.randint(1, 9)
# avoid negative answers
if b > a:
a, b = b, a
View
3 moztrap/view/utils/mtforms.py
@@ -23,7 +23,8 @@
class NonFieldErrorList(ErrorList):
"""A custom ErrorList for non-field errors with "nonfield" HTML class."""
def as_ul(self):
- if not self: return u''
+ if not self:
+ return u''
return mark_safe(u'<ul class="errorlist nonfield">%s</ul>'
% ''.join([u'<li>%s</li>' % conditional_escape(force_unicode(e)) for e in self]))
View
6 tests/case/api/base.py
@@ -46,7 +46,7 @@ def patch(self, url, payload="", params={}, status=202):
return self.app.patch(
url,
json_data,
- headers = {"content-type": "application/json"},
+ headers={"content-type": "application/json"},
status=status,
)
@@ -59,7 +59,7 @@ def post(self, url, payload="", params={}, status=201):
return self.app.post(
url,
json_data,
- headers = {"content-type": "application/json"},
+ headers={"content-type": "application/json"},
status=status,
)
@@ -71,7 +71,7 @@ def put(self, url, data={}, params={}, status=202):
return self.app.put(
url,
json_data,
- headers = {"content-type": "application/json"},
+ headers={"content-type": "application/json"},
status=status,
)
View
16 tests/model/core/api/test_product_resource.py
@@ -22,7 +22,7 @@ def resource_name(self):
@property
def permission(self):
- """String defining the permission required for
+ """String defining the permission required for
Create, Update, and Delete."""
return "core.manage_products"
@@ -34,7 +34,7 @@ def wrong_permissions(self):
def clean_backend_data(self, backend_obj):
- """Returns backend_data, minus any keys not generated by
+ """Returns backend_data, minus any keys not generated by
new_object_data.
Should be extended for objects that have one-to-many foriegn keys.
@@ -57,7 +57,7 @@ def new_object_data(self):
"""Generates a dictionary containing the field names and auto-generated
values needed to create a unique object.
- The output of this method can be sent in the payload parameter of a
+ The output of this method can be sent in the payload parameter of a
POST message.
"""
self.product_fixture = self.F.ProductFactory.create()
@@ -69,7 +69,7 @@ def new_object_data(self):
u"productversions": [{
u"version": unicode(self.datetime),
u"codename": unicode(
- "amazing test %s %s"% (self.datetime, self.resource_name)),
+ "amazing test %s %s" % (self.datetime, self.resource_name)),
}]
}
return fields
@@ -81,10 +81,10 @@ def backend_object(self, id):
"""
return self.model.Product.everything.get(id=id)
-
+
def backend_data(self, backend_obj):
- """Query's the database for the object's current values. Output is a
- dictionary that should match the result of getting the object's detail
+ """Query's the database for the object's current values. Output is a
+ dictionary that should match the result of getting the object's detail
via the API, and can be used to verify API output.
Note: both keys and data should be in unicode
@@ -157,7 +157,7 @@ def test_productversion_for_create_must_be_list(self):
def test_productversion_list_for_create_must_not_be_empty(self):
"""If the productversions list does not contain an item, there will be a 500 error."""
-
+
# get data for creation
fields = self.new_object_data
View
10 tests/model/core/api/test_productversion_env_resource.py
@@ -37,11 +37,11 @@ def test_productversionenvironments_list(self):
act_meta = res.json["meta"]
exp_meta = {
- "limit" : 20,
- "next" : None,
- "offset" : 0,
- "previous" : None,
- "total_count" : 1,
+ "limit": 20,
+ "next": None,
+ "offset": 0,
+ "previous": None,
+ "total_count": 1,
}
self.assertEquals(act_meta, exp_meta)
View
2 tests/model/core/api/test_productversion_resource.py
@@ -47,7 +47,7 @@ def new_object_data(self):
self.get_detail_url('product', str(self.product_fixture.id))),
u"version": unicode(self.datetime),
u"codename": unicode(
- "amazing test %s %s"% (self.datetime, self.resource_name)),
+ "amazing test %s %s" % (self.datetime, self.resource_name)),
}
return fields
View
1 tests/model/core/models/test_user.py
@@ -8,4 +8,3 @@
class UserTest(case.DBTestCase):
"""Tests for User proxy model."""
-
View
10 tests/model/environments/api/test_category_resource.py
@@ -28,11 +28,11 @@ def test_category_list(self):
act_meta = res.json["meta"]
exp_meta = {
- "limit" : 20,
- "next" : None,
- "offset" : 0,
- "previous" : None,
- "total_count" : 1,
+ "limit": 20,
+ "next": None,
+ "offset": 0,
+ "previous": None,
+ "total_count": 1,
}
self.assertEquals(act_meta, exp_meta)
View
10 tests/model/environments/api/test_element_resource.py
@@ -29,11 +29,11 @@ def test_element_list(self):
act_meta = res.json["meta"]
exp_meta = {
- "limit" : 20,
- "next" : None,
- "offset" : 0,
- "previous" : None,
- "total_count" : 1,
+ "limit": 20,
+ "next": None,
+ "offset": 0,
+ "previous": None,
+ "total_count": 1,
}
self.assertEquals(act_meta, exp_meta)
View
10 tests/model/environments/api/test_environment_resource.py
@@ -31,11 +31,11 @@ def test_environment_list(self):
act_meta = res.json["meta"]
exp_meta = {
- "limit" : 20,
- "next" : None,
- "offset" : 0,
- "previous" : None,
- "total_count" : 1,
+ "limit": 20,
+ "next": None,
+ "offset": 0,
+ "previous": None,
+ "total_count": 1,
}
self.assertEquals(act_meta, exp_meta)
View
16 tests/model/execution/api/test_result.py
@@ -37,17 +37,17 @@ def test_submit_results_for_run(self):
c_p = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="PassCase",
)
c_i = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="InvalidCase",
)
c_f = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="FailCase",
)
self.F.CaseStepFactory(caseversion=c_f)
@@ -127,7 +127,7 @@ def test_submit_results_for_run_no_status(self):
c_p = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="PassCase",
)
@@ -167,7 +167,7 @@ def test_submit_results_for_run_bad_env_id(self):
c_p = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="PassCase",
)
@@ -208,7 +208,7 @@ def test_submit_results_for_run_no_runcaseversion(self):
c_p = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="PassCase",
)
@@ -242,7 +242,7 @@ def test_submit_results_for_run_no_authentication(self):
c_p = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="PassCase",
)
@@ -280,7 +280,7 @@ def test_submit_results_for_run_no_authorization(self):
c_p = self.F.CaseVersionFactory.create(
case__product=pv.product,
- productversion = pv,
+ productversion=pv,
name="PassCase",
)
View
13 tests/model/execution/api/test_run.py
@@ -50,11 +50,11 @@ def test_run_list(self):
res = self.get_list(params=self.auth_params)
exp_meta = {
- "limit" : 20,
- "next" : None,
- "offset" : 0,
- "previous" : None,
- "total_count" : 2,
+ "limit": 20,
+ "next": None,
+ "offset": 0,
+ "previous": None,
+ "total_count": 2,
}
self.assertEquals(res.json["meta"], exp_meta)
@@ -465,6 +465,3 @@ def test_submit_run_no_user(self):
params=params,
status=401,
)
-
-
-
View
12 tests/model/execution/api/test_runcaseversion.py
@@ -37,11 +37,11 @@ def test_runcaseversion_list(self):
act_meta = act["meta"]
exp_meta = {
- "limit" : 20,
- "next" : None,
- "offset" : 0,
- "previous" : None,
- "total_count" : 2,
+ "limit": 20,
+ "next": None,
+ "offset": 0,
+ "previous": None,
+ "total_count": 2,
}
self.assertEquals(act_meta, exp_meta)
@@ -70,7 +70,7 @@ def test_runcaseversion_list(self):
u'status': unicode(cv.status),
},
u"id": unicode(rcv.id),
- u"run": unicode(self.get_detail_url("run",rcv.run.id)),
+ u"run": unicode(self.get_detail_url("run", rcv.run.id)),
u"resource_uri": unicode(self.get_detail_url(
"runcaseversion",
rcv.id,
View
2 tests/model/execution/models/test_result.py
@@ -58,7 +58,7 @@ def test_save_old_result_doesnt_become_latest(self):
r2 = rcv.results.get(is_latest=True)
r1 = self.refresh(r1)
- r1.comment="this is it"
+ r1.comment = "this is it"
r1.save()
r1 = self.refresh(r1)
View
12 tests/model/execution/models/test_run.py
@@ -25,7 +25,7 @@ def test_invalid_dates(self):
today = datetime.date(2011, 12, 13)
r = self.F.RunFactory(
start=today,
- end=today-datetime.timedelta(days=1))
+ end=today - datetime.timedelta(days=1))
with self.assertRaises(ValidationError):
r.full_clean()
@@ -36,7 +36,7 @@ def test_valid_dates(self):
today = datetime.date(2011, 12, 13)
r = self.F.RunFactory(
start=today,
- end=today+datetime.timedelta(days=1))
+ end=today + datetime.timedelta(days=1))
r.full_clean()
@@ -848,7 +848,7 @@ def test_query_count_on_activate(self):
cv_needed = []
for num in range(6):
cv = self.F.CaseVersionFactory.create(
- name="casey"+str(num),
+ name="casey" + str(num),
productversion=self.pv8,
status="active",
)
@@ -943,7 +943,7 @@ def test_run_refresh(self):
cv_needed = []
for num in range(6):
cv = self.F.CaseVersionFactory.create(
- name="casey"+str(num),
+ name="casey" + str(num),
productversion=self.pv8,
status="active",
)
@@ -1048,7 +1048,7 @@ def create_run_needing_refresh(self):
cv_needed = []
for num in range(6):
cv = self.F.CaseVersionFactory.create(
- name="casey"+str(num),
+ name="casey" + str(num),
productversion=self.pv8,
status="active",
)
@@ -1106,8 +1106,10 @@ def do_rollback_test(self, new_func):
class SurpriseException(RuntimeError):
pass
+
def raise_exception(*args, **kwargs):
raise SurpriseException("Surprise!")
+
new_func.side_effect = raise_exception
with self.assertRaises(SurpriseException):
View
2 tests/model/execution/models/test_runcaseversion.py
@@ -323,7 +323,7 @@ def test_result_fail(self):
rcv = self.F.RunCaseVersionFactory.create(run=run)
u = self.F.UserFactory.create()
- rcv.result_fail(environment= envs[0], user=u)
+ rcv.result_fail(environment=envs[0], user=u)
r = rcv.results.get()
self.assertEqual(r.status, "failed")
View
2 tests/model/library/api/test_case_resource.py
@@ -347,7 +347,7 @@ def get_exp_obj(self, cv, order=None):
u"productversion": unicode(
self.get_detail_url("productversion", cv.productversion.id)),
u"resource_uri": unicode(
- self.get_detail_url("caseselection",cv.id)),
+ self.get_detail_url("caseselection", cv.id)),
u"tags": [],
}
View
6 tests/model/library/api/test_caseversion_resource.py
@@ -252,7 +252,7 @@ def get_exp_obj(self, cv, tags=[]):
u"id": unicode(t.id),
u"name": unicode(t.name),
u"description": unicode(t.description),
- u"resource_uri": unicode(self.get_detail_url("tag",t.id)),
+ u"resource_uri": unicode(self.get_detail_url("tag", t.id)),
u"product": None,
}
if t.product:
@@ -262,7 +262,7 @@ def get_exp_obj(self, cv, tags=[]):
return {
u"case": unicode(
- self.get_detail_url("case",cv.case.id)),
+ self.get_detail_url("case", cv.case.id)),
u"case_id": unicode(cv.case.id),
u"created_