Commit graph

216 commits

Author SHA1 Message Date
Andy Allan
0925035a3e Add tests to ensure tokens are revoked
This ensures that tokens are revoked or invalidated when a user
is soft destroyed.
2022-12-28 15:25:57 +00:00
Andy Allan
415ac577f3 Remove some old debugging comments 2022-12-21 12:05:15 +00:00
Tom Hughes
9cd96bd452 Fix new rubocop warnings 2022-09-09 22:45:58 +01:00
Anton Khorev
b54c03389b Strip leading/trailing whitespace from comma-separated trace tags 2022-07-19 13:47:28 +03:00
Tom Hughes
a3a228862c Add validation for relation member roles
Fixes #3563
2022-06-09 19:21:08 +01:00
Harry Wood
3ca8b63643 Put issue comments through kramdown formatter
On issue comments (which only admins can create or see), put the `body` text through kramdown formatting.
2022-05-06 13:36:59 +01:00
Harry Wood
e204e1d178 Add some basic testing of issue_comment model
A factory and a basic test of validation for the issue_comment model, similar to what we have for diary_comment.
2022-05-06 12:38:17 +01:00
Harry Wood
9401e451d1 Format report text with kramdown
Pass the text of reports ('details' field) through the RichText formatter to give us kramdown formatting support.
2022-04-29 01:31:39 +01:00
Andy Allan
5c2cb9e96f Use factories for tag uniqueness tests 2022-03-30 17:15:11 +01:00
Andy Allan
034db6820f Simplify changeset tag tests by using factories
This saves lots of boilerplate in creating a valid test object
2022-03-30 17:03:04 +01:00
Andy Allan
374518f58a Rework 'empty' tag tests
These tests were checking that the parent object was set, but this
was not obvious from the way that the tests were named and constructed.

This refactoring makes it clearer what is being checked.
2022-03-30 16:37:16 +01:00
Tom Hughes
03cad948e3 Fix new rubocop warnings 2022-03-15 19:24:09 +00:00
Andy Allan
d6f8302eae
Merge pull request #3491 from tomhughes/legacy-trace
Remove support for legacy trace files
2022-03-09 17:10:40 +00:00
Tom Hughes
cbcc7dc49f Fix some rubocop Naming/PredicateName warnings 2022-03-03 22:47:55 +00:00
Tom Hughes
92b122759f Remove support for legacy trace files 2022-03-03 19:47:40 +00:00
Tom Hughes
b5f06e06c1 Fix rubocop Rails/TimeZone warnings 2022-03-01 22:55:10 +00:00
Andy Allan
2fabc46421
Merge pull request #3440 from mmd-osm/relationmemberlimit
Introduce relation member limit
2022-02-16 14:58:30 +00:00
Tom Hughes
53aa7259bb Merge remote-tracking branch 'upstream/pull/3345' 2022-02-13 18:39:21 +00:00
mmd-osm
2efd73c672 Introduce relation member limit
Adds a new parameter `max_number_of_relation_members` in settings.yml
2022-02-02 13:15:40 +01:00
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
Andy Allan
0100cfe304 Use factory_bot to build new model objects 2022-01-06 10:46:38 +00:00
Andy Allan
88cf03ff00 Use factorybot to build user objects
This allows us to only specify attributes of interest in the test.
2022-01-05 20:29:12 +00:00
Andy Allan
a863be8831 Rename User#delete to User#destroy
"delete" is generally used for immediate SQL deletion without running
any callbacks or other ruby code, whereas "destroy" will trigger callbacks.

Although we don't currently use any callbacks, let's rename this method to
align better with the convention.
2021-12-22 11:32:33 +00:00
Tom Hughes
0410596908 Switch traces to use ActiveStorage 2021-12-16 18:45:31 +00:00
Andy Allan
9ab15f38ea Move the tracepoint coordinate format test to the controller test
This allows us to remove the model method
2021-09-29 15:25:28 +01:00
Andy Allan
d07ce46929 Move the xml format test for old nodes to the controller test
This allows us to remove the model method
2021-09-15 17:05:34 +01:00
Josh Soref
590f94f531 spelling: uniqueness
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-07-21 10:45:38 -04:00
Andy Allan
37b03e47c6 Fix various code comments
These were found as part of #3233
2021-07-21 11:24:23 +01:00
Tom Hughes
da546af22e Allow acls to match on parent domains 2021-07-06 10:13:33 +01:00
Andy Allan
408c883d24 Skip intermediate lengths when testing tag validity
It's really the upper and lower boundaries that we want to check,
and it's reasonable to assume all the intermediate values will work
fine if the boundary values are tested.

This also saves about 75% of the time taken and almost 85% of the
assertions when running all the model tests.
2021-06-16 09:53:57 +01:00
Tom Hughes
70d7d8d850 Fix some ruby 3 compatibility issues 2021-04-22 19:20:25 +01:00
Tom Hughes
3512d6303c Fix new rubocop warnings 2021-03-23 19:48:13 +00:00
Tom Hughes
0ff89c31e4 Remove both Potlatch versions
Fixes #2622
2021-01-05 21:18:45 +00:00
Tom Hughes
88ba316abe Merge remote-tracking branch 'upstream/pull/2999' 2020-12-09 14:51:04 +00:00
Tom Hughes
582402ba8f Prefer keyword arguments when method has optional boolean arguments 2020-11-13 10:22:55 +00:00
Andy Allan
1f242978af Prefer keyword arguments when method has optional boolean arguments 2020-11-12 11:24:44 +00:00
Andy Allan
a65cb84288 Remove unused code 2020-11-11 16:43:58 +00:00
Tom Hughes
ea59d95f4a Fix some new rubocop warnings 2020-08-06 22:27:30 +01:00
Tom Hughes
2d3972249c Fix some rubocop todos 2020-08-02 19:38:58 +01:00
Tom Hughes
7a1615bc55 Fix rubocop-minitest warnings 2020-04-15 19:07:13 +01:00
Andy Allan
a219df24ca Ensure that urls are only valid if the entire string is a url
This replaces our homegrown regexps (that didn't quite work) with
ruby built-in regexps, and uses the termination anchor to ensure
that the entire string, not just the first part, is validated.
2020-04-01 17:53:37 +02: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
979a474c68 Use unique test directories for each trace test
This allows tests to be run in parallel, since it avoids deleting
some of the symlinks that other tests expect to be there.
2020-03-18 15:04:18 +01:00
Tom Hughes
57f5b7840e Fix rubocop warnings 2019-12-04 19:31:53 +00:00
Andy Allan
ae5c364e97 Move the format tests to test the output from the controller 2019-11-13 15:21:41 +01:00
Tom Hughes
135ec35a91 Fix numericality validation to use correct integer only constraint
Fixes #2355
2019-08-22 12:14:06 +01:00
Tom Hughes
18f5f1d499 Explicitly require gpx in the trace model tests
If we don't do this and no other test manages to trigger an
autoload before we run then we might try and autoload it inside
a MockFS block which will fail.
2019-08-14 19:10:15 +01:00
Tom Hughes
91a37235ac Remove support for old style user images 2019-07-16 22:33:26 +01:00
Tom Hughes
d2d5d48f29 Allow signups to be blocked by MX host 2019-06-23 11:21:03 +01:00
Andy Allan
2169c503ef Rename user.friend_users to user.friends
This is possible now since we've renamed Friend to Friendship
2019-06-19 16:51:35 +02:00