Commit graph

82 commits

Author SHA1 Message Date
Andy Allan
1a11c4dc19 Use a state machine for user status
The user status is a bit complex, since there are various states and
not all transitions between them make sense.

Using AASM means that we can name and restrict the transitions, which
hopefully makes them easier to reason about.
2022-01-12 18:16:14 +00:00
Tom Hughes
6c6e8883f7 Introduce privileged scopes that only an administrator can enable 2021-08-26 17:22:24 +01:00
Tom Hughes
608aafbf14 Make /api/0.6/permissions work for OAuth 2 clients 2021-06-27 00:38:16 +01:00
Tom Hughes
f064a18a16 Add tests for OAuth2 2021-05-18 12:05:33 +01:00
Tom Hughes
0654be27f9 Fix new rubocop warnings 2021-01-11 19:17:31 +00:00
Tom Hughes
f75eb6fe9e Refactor more controller tests 2020-04-27 22:24:28 +01:00
Andy Allan
1cb0767e3d Copy trace fixture files, rather than symlinking
Since we are using tmpdirs in order to enable parallel testing, we
can go the full hog and drop the fakefs too and just copy all the
files directly into the tmpdir. If a test makes changes (e.g.
changing the icon file during an import) the copy in the tmpdir is
thrown away at the end of the test anyway.
2020-03-18 15:35:55 +01:00
Andy Allan
8407c0dd98 Use the settings for the destination of the gpx fixture symlinks
This lets us change the settings values and have the fixtures appear
in the right place.
2020-03-18 14:58:48 +01:00
Tom Hughes
4b8f0a7389 Give factory created traces a size
Traces which are marked as inserted are expected to have a size.
2019-10-13 12:18:57 +01:00
Andy Allan
1cf8fec58d Rename Friend model to Friendship
This better describes what the model represents, which is the relationship
between the two users.
2019-06-19 16:39:25 +02:00
Andy Allan
35a2d66e19 Remove require_terms_agreed configuration option
This has been set to true for 6 years in production. Refs #2097

As per other user settings, we set the terms as seen by default for tests,
and we can override that when necessary for specific tests.
2019-02-06 15:50:57 +01:00
Andy Allan
8f70fb2114 Use CanCanCan for changeset comments
This introduces different deny_access handlers for web and api requests, since we want to avoid sending redirects as API responses. See #2064 for discussion.
2018-11-28 12:35:45 +01:00
Tom Hughes
06915a77b5 Fix FactoryBot deprecation warnings 2018-08-28 19:12:01 +01:00
Tom Hughes
e5604ce98e Assign vandalism reports for users to moderators 2018-06-17 11:14:19 +01:00
Andy Allan
63992d83bd Store the report category. 2017-12-13 16:02:55 +00:00
Andy Allan
f5228657fe Refactor factories to use FactoryBot 2017-11-29 12:33:23 +00:00
Andy Allan
effb1b7f41 Merge branch 'master' into moderation 2017-11-29 12:18:39 +00:00
Tom Hughes
b2fa947502 Replace factory_girl with factory_bot 2017-10-29 19:29:30 +00:00
Andy Allan
c00c515d9d Ensure report details are not blank. 2017-09-06 18:17:54 +01:00
Andy Allan
99df5f6179 Rename association to reported_user, for clarity 2017-07-12 11:44:05 +01:00
Andy Allan
6f375ef493 Get tests passing. Use factories instead of fixtures. 2017-07-12 11:38:50 +01:00
Andy Allan
3f3ffdfea1 Refactor old_relation_controller tests to use factories. 2017-05-10 14:11:53 +01:00
Andy Allan
3fa3658efa Update old_ways_controller tests to use factories. 2017-05-10 13:38:10 +01:00
Andy Allan
1df5bd247f Ensure the old nodes are created with the same changeset
Not often important, but the most recent old_node should definitely
have the same changeset as the node itself.
2017-05-10 11:51:43 +01:00
Andy Allan
d48603d9e0 Add a way_with_nodes factory, and use it in the way_controller tests. 2017-04-26 08:34:01 +02:00
Andy Allan
75c5d6619a Refactor some amf_controller tests to use factories. 2017-04-25 17:47:58 +02:00
Andy Allan
7f957bac76 Use factories for all factory associations. 2017-04-25 16:52:29 +02:00
Andy Allan
805abe96d0 Create an old_way_node factory, and start using it for tests. 2017-04-25 16:29:13 +02:00
Andy Allan
05a42281ab Create an old_way factory, and start using it for tests. 2017-04-25 16:29:13 +02:00
Andy Allan
b46028b4f7 Create an old_relation_member factory, and start using it for tests. 2017-04-25 16:29:13 +02:00
Andy Allan
27c3edae25 Create an old_relation factory, and start using it for tests. 2017-04-25 15:19:25 +02:00
Andy Allan
d595577a49 Convert the duplicate_tags node controller test to use factories. 2017-04-24 20:41:43 +02:00
Andy Allan
5ab082a047 Add the closed trait to changeset factories. 2017-03-31 10:47:41 +01:00
Andy Allan
1b7ab315bb Add factories for relations, relation_members, ways and way_nodes 2017-03-31 10:40:49 +01:00
Andy Allan
66ae9a48a6 For deleted nodes created via factories, make sure the most recent old_node is also deleted 2017-03-30 13:57:07 +01:00
Andy Allan
17e9bcd2d4 Use factories for nodes in browse_helper tests. 2017-03-30 13:19:24 +01:00
Andy Allan
5a0ba2e812 Add a with_history trait for node factories, to automatically create corresponding old_nodes 2017-03-30 09:31:22 +01:00
Tom Hughes
9ae3df1a78 Use changeset factory for association in node factory 2017-03-22 20:31:25 +00:00
Tom Hughes
b78bb9f631 Merge remote-tracking branch 'openstreetmap/pull/1496' 2017-03-22 19:19:59 +00:00
Andy Allan
1a3130ec61 Create a node factory, and use it for most node model tests 2017-03-22 17:50:10 +00:00
Andy Allan
24cd3af31e Use changeset factory for factory associations
One test needed updating since it assumed the comments were being
created on a particular changeset.
2017-03-22 11:09:52 +00:00
Andy Allan
56752ac02a Create a changeset factory, and use it for model tests. 2017-03-22 10:47:24 +00:00
Tom Hughes
834a821d3c Merge remote-tracking branch 'openstreetmap/pull/1492' 2017-03-16 19:02:35 +00:00
Andy Allan
a0899d1b0b Use redactions factory in redaction controller test. 2017-03-15 17:01:41 +00:00
Andy Allan
006627789f Create a redactions factory and use for model tests. 2017-03-15 16:24:39 +00:00
Andy Allan
5370f9c6a7 Refactor the oauth integration test to avoid using user fixtures. 2017-03-15 16:13:04 +00:00
Andy Allan
eac26c9a2c Create a super_user factory. 2017-03-09 16:21:51 +00:00
Andy Allan
a3618d2b5f User factory associations for all factories. 2017-02-22 18:51:45 +00:00
Andy Allan
91f3339b6a Make all factory-generated users 'normal'
The use of create(:normal_user) makes the tests needlessly harder to
understand and reason about, particularly when we start using
associations in the factories.
2017-02-22 18:26:03 +00:00
Andy Allan
737a325f2e Refactor diary entry tests to use User factory 2017-02-19 16:43:32 +00:00