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

Commit

Permalink
Merge branch 'master' into display-all-sc-items
Browse files Browse the repository at this point in the history
  • Loading branch information
Dayton Nolan committed Aug 29, 2016
2 parents 3847975 + 5700d5b commit 0f766ce
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
15 changes: 6 additions & 9 deletions README.md
Expand Up @@ -19,15 +19,12 @@ pip install "file://$(pwd)#egg=django-bulbs[dev]"

## Running Tests

1. Clone [django-elastimorphic](https://github.com/theonion/django-elastimorphic) into a sibiling directory
2. Install dev requirements
```bash
pip install -e ".[dev]"
```
3. Run tests
```bash
py.test tests/
```
1. Clone, setup, and start [onion-services](https://github.com/theonion/onion-services/blob/master/README.md).
2. Run `./scripts/init_db`
3. Run `./scripts/test`

A relative path to a folder or file can be given to `./scripts/test` to run
only a specific subset of tests.

## Building Docs
```bash
Expand Down
2 changes: 1 addition & 1 deletion bulbs/__init__.py
@@ -1 +1 @@
__version__ = "3.12.3"
__version__ = "3.12.4"
2 changes: 1 addition & 1 deletion bulbs/super_features/views.py
Expand Up @@ -64,7 +64,7 @@ class SetChildrenDatesViewSet(views.APIView):
def put(self, request, pk):
parent = get_object_or_404(SUPERFEATURE_MODEL, pk=pk)

if not parent.is_published:
if not parent.published:
return Response(
{'detail': 'Parent publish date is not set'},
status=status.HTTP_400_BAD_REQUEST
Expand Down
19 changes: 19 additions & 0 deletions tests/super_features/test_views.py
@@ -1,4 +1,5 @@
from collections import OrderedDict
from datetime import timedelta

from django.core.urlresolvers import reverse
from django.utils import timezone
Expand Down Expand Up @@ -125,6 +126,24 @@ def test_parent_set_child_dates(self):
child = BaseSuperFeature.objects.get(id=self.child.id)
self.assertEqual(self.parent.published, child.published)

def test_parent_set_child_dates_in_future(self):
"""Should be able to set publish dates for children even if parent
publish date is in the future."""

self.parent.published = timezone.now() + timedelta(days=1)
self.parent.save()

url = reverse(
'super-feature-set-children-dates',
kwargs={'pk': self.parent.pk}
)
resp = self.api_client.put(url)

self.assertEqual(resp.status_code, 200)

child = BaseSuperFeature.objects.get(id=self.child.id)
self.assertEqual(self.parent.published, child.published)

def test_relations_ordering(self):
child2 = BaseSuperFeature.objects.create(
title="Guide to Bats",
Expand Down

0 comments on commit 0f766ce

Please sign in to comment.