Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for private search [OSF-6898] #6184

Closed
wants to merge 65 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
7bdb917
Shuffle classes around in test_search/test_views
chadwhitacre Aug 23, 2016
4d6d0d7
Start a class for project search API (v1) tests
chadwhitacre Aug 23, 2016
b3d31cc
Rewrite tests using parameterization
chadwhitacre Aug 29, 2016
aae954d
Expand to registrations
chadwhitacre Aug 29, 2016
c579dfa
Expand to components
chadwhitacre Aug 30, 2016
626eaee
Clean up tests we have so far
chadwhitacre Aug 30, 2016
82f0054
Expand to files
chadwhitacre Aug 30, 2016
a0dedae
Use mock_archive for the registration case
chadwhitacre Sep 5, 2016
ca09ac6
Fix two public/anon tests
chadwhitacre Sep 13, 2016
a0ddd4b
There is no such thing as a "private registration"
chadwhitacre Sep 16, 2016
6c4eaf5
Extend to cover authenticated users
chadwhitacre Sep 16, 2016
1f3c16e
Factor out factory functions
chadwhitacre Sep 16, 2016
adebf15
Naively failing tests for private read
chadwhitacre Sep 19, 2016
8e2e87e
Start stubbing out fixture tests
chadwhitacre Sep 19, 2016
448386a
Write tests for project creation
chadwhitacre Sep 19, 2016
8a13e46
More tests for projects, registrations, components
chadwhitacre Sep 19, 2016
ab07f2c
Additional tests for files
chadwhitacre Sep 19, 2016
e75452f
Check for default permissions
chadwhitacre Sep 19, 2016
c33663f
Don't return from makers
chadwhitacre Sep 19, 2016
bacab80
Wire up a contributor: *now* they're failing tests
chadwhitacre Sep 23, 2016
7260be1
Remove some tests that don't matter anymore
chadwhitacre Sep 26, 2016
7631317
Remove more out of date tests
chadwhitacre Sep 26, 2016
37b41b9
The thing is a node
chadwhitacre Sep 27, 2016
9367f1a
Fix TestMakers
chadwhitacre Sep 27, 2016
2f3bd8a
Start evolving towards a generator
chadwhitacre Sep 27, 2016
68ff540
Generate test cases programmatically
chadwhitacre Sep 27, 2016
59f9fab
Add a couple tests for the generator itself
chadwhitacre Sep 27, 2016
2c5bb2e
Push perms work out of test func
chadwhitacre Sep 27, 2016
28ca96b
Add a test suite for the permfuncs
chadwhitacre Sep 27, 2016
c0bafac
Factor out varyfuncs and nodefuncs
chadwhitacre Sep 28, 2016
58f12a3
Move permissions tests to their own file
chadwhitacre Sep 28, 2016
1067bf0
Teach parameterized tests about expected failures
chadwhitacre Oct 3, 2016
53c0a82
Fix bug with unexpected successes
chadwhitacre Oct 5, 2016
7856c5a
Tweak some names
chadwhitacre Oct 5, 2016
b93af5f
Add in unapproved unembargoed registrations
chadwhitacre Oct 6, 2016
c697edc
Deduplicate a couple things
chadwhitacre Oct 7, 2016
41435f4
Neaten up varyfuncs
chadwhitacre Oct 7, 2016
b71cb55
Embargoed, unapproved registration
chadwhitacre Oct 10, 2016
3b75f26
Start generating reg. variants programmatically
chadwhitacre Oct 15, 2016
2b64ea4
Bring back approved embargo
chadwhitacre Oct 15, 2016
5ec0c2d
Mix completeness into the regfunc generator
chadwhitacre Oct 31, 2016
8691b0a
Fill out the rest of the new regfunc tests
chadwhitacre Oct 31, 2016
6fca079
Add a test for the number of tests
chadwhitacre Nov 8, 2016
64d0eb0
Include retraction info in regfunc name
chadwhitacre Nov 8, 2016
1388a39
Mix in unapproved retractions
chadwhitacre Nov 8, 2016
dff447a
DRY up the regfunc tests
chadwhitacre Nov 8, 2016
dcc5afc
Remove redundant check from some tests
chadwhitacre Nov 8, 2016
a00d846
Round out regfuncs with approved retractions
chadwhitacre Nov 9, 2016
415cf42
Update expectations regarding retractions
chadwhitacre Nov 19, 2016
8bca5a9
Update number of tests
chadwhitacre Nov 21, 2016
6ff3658
Remove unused constants
chadwhitacre Nov 21, 2016
5b1efc3
Remove a vestigial helper
chadwhitacre Nov 21, 2016
96a1a46
Refactor into multiple files
chadwhitacre Nov 21, 2016
056b5a8
Clean up some names and comments
chadwhitacre Nov 23, 2016
78de3ab
Fix the build and clean up a few more things
chadwhitacre Nov 24, 2016
b09234a
Add tests for searching wiki content
chadwhitacre Nov 26, 2016
4d956fd
Rewire nodefuncs ahead of varying parent.is_public
chadwhitacre Nov 26, 2016
188b42f
Add in cases where parent differs from component
chadwhitacre Nov 26, 2016
dc77f5a
Make room for previously embargoed registrations
chadwhitacre Nov 27, 2016
2a79ef7
Refactor for clarity
chadwhitacre Dec 7, 2016
c89f932
Refactor varyfuncs a bit
chadwhitacre Dec 7, 2016
da489a2
Add in formerly embargoed cases
chadwhitacre Dec 7, 2016
624575b
DRY up regfunc tests
chadwhitacre Dec 9, 2016
6e2510f
Use a dict other than locals()
chadwhitacre Dec 9, 2016
c5e5800
Make unembargoed parallel to unretracted
chadwhitacre Dec 9, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests for searching wiki content
chadwhitacre committed Dec 10, 2016
commit b09234ac796cf0c38e4e7012cc0873ea909adfb5
2 changes: 1 addition & 1 deletion tests/test_search/test_permissions/__init__.py
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ class TestGenerateCases(unittest.TestCase):
# gc - generate_cases

def test_gc_generates_cases(self):
assert_equal(len(list(generate_cases())), 144)
assert_equal(len(list(generate_cases())), 156)

def test_gc_doesnt_create_any_nodes(self):
list(generate_cases())
22 changes: 21 additions & 1 deletion tests/test_search/test_permissions/test_varyfuncs.py
Original file line number Diff line number Diff line change
@@ -6,11 +6,13 @@
from nose.tools import assert_equal, ok_

from modularodm import Q
from framework.auth import Auth
from tests import factories
from tests.base import DbIsolationMixin
from tests.test_search import OsfTestCase
from tests.test_search.test_permissions.test_nodefuncs import proj, comp
from tests.utils import mock_archive
from tests.utils import mock_archive, run_celery_tasks
from website.addons.wiki.model import NodeWikiPage
from website.files.models.base import File
from website.project.model import Node

@@ -28,6 +30,13 @@ def file_on(node):
return 'blim', 'file', 'name', 'Blim Blammity'


def wiki_on(node):
category = 'project' if node.parent_node is None else 'component'
with run_celery_tasks():
node.update_node_wiki('Blim Blammity', 'Blim, blammity.', Auth(node.creator))
return 'blim', category, 'title', 'Flim Flammity'


# Registrations are more complicated, because they have multiple possible
# states. We therefore have a second-level generator to programmatically create
# the functions to vary a node according to the different registration states.
@@ -99,6 +108,7 @@ def create_regfuncs():
VARYFUNCS = (
base,
file_on,
wiki_on,
) + tuple(REGFUNCS)


@@ -120,6 +130,16 @@ def test_fo_makes_a_file_on_a_node(self):
assert_equal(File.find_one(Q('is_file', 'eq', True)).name, 'Blim Blammity')


# wo - wiki_on

def test_wo_makes_a_wiki_on_a_node(self):
project = factories.ProjectFactory()
wiki_on(project)
page = NodeWikiPage.load(project.wiki_pages_current['blim blammity'])
assert_equal(page.page_name, 'Blim Blammity')
assert_equal(page.content, 'Blim, blammity.')


# regfuncs

def Reg(self, func):