Commit Graph

878 Commits (0d7fead82a2e629a16bb4aaf8a30fa470344c727)

Author SHA1 Message Date
Rick Carlino b49b128c60 Search by type 2018-05-25 09:24:34 -05:00
Rick Carlino 55e61b1132 Tests for Ruby code 2018-05-23 08:53:43 -05:00
Rick Carlino fb26b24dab Rename: Throttler => TimePeriod 2018-05-23 08:38:17 -05:00
Rick Carlino 3e464e30a7 Move subclasses into files 2018-05-23 08:32:06 -05:00
Rick Carlino b3a30dd027 Works! 2018-05-22 16:02:22 -05:00
Rick Carlino 422b03af60 Fix Device#maybe_throttle 2018-05-22 15:45:26 -05:00
Rick Carlino 78ba739c1d Explain policy violations in toast 2018-05-22 15:36:05 -05:00
Rick Carlino 0676f36a60 Stub some things out, write test for Device#is_device 2018-05-22 11:30:29 -05:00
Rick Carlino f9d6966a02 Fix tests so they pass in locations outside of Chicago :-P 2018-05-21 15:16:44 -05:00
Rick Carlino 6075b1125b Tests done. Next: conditional log message for cooldown period 2018-05-21 14:12:36 -05:00
Rick Carlino 92b88f44dc Device#maybe_unthrottle specs 2018-05-21 13:57:04 -05:00
Rick Carlino 7b8eacb7fd Marshal.load bugfix + `maybe_throtle` tests. 2018-05-21 13:54:13 -05:00
Rick Carlino bb55058d53 Test fix for caching stuff 2018-05-21 13:30:41 -05:00
Rick Carlino 49d03db3e6 Device#cached_find tests 2018-05-21 13:17:12 -05:00
Rick Carlino 9f78fc11f2 Changes to accomodate new throttle message 2018-05-21 09:30:25 -05:00
Rick Carlino ddd8c03ced Specs / implementation for Throttler#when_does_next_period_start? 2018-05-21 08:39:18 -05:00
Rick Carlino edc2caebcf Tests for AmqpLogParser edge cases 2018-05-20 18:36:20 -05:00
Rick Carlino 5982532e38 Seperate parsing / validation concerns out of `LogService` 2018-05-20 17:17:59 -05:00
Rick Carlino 3d0a9b6b44 Done 2018-05-18 14:21:04 -05:00
Rick Carlino e5106f93c8 ThrottlePolicy#attempt_throttled_action 2018-05-18 13:44:35 -05:00
Rick Carlino 2a5f0a3c91 ThrottlePolicy + tests. NEXT: ThrottlePolicy#attempt 2018-05-18 13:13:45 -05:00
Rick Carlino 1de2121554 Start ThrottlePolicy class 2018-05-18 11:46:02 -05:00
Rick Carlino 4bdb6713d2 Add throttler class 2018-05-18 11:21:15 -05:00
Rick Carlino 06174e00c7 New DB indexes, update Rails. 2018-05-18 08:30:36 -05:00
Rick Carlino 7e0957d580 More tests 2018-05-12 09:26:47 -05:00
Rick Carlino e8a3c8caa3 Tests and file (image) removal 2018-05-12 09:24:30 -05:00
Rick Carlino d95f5b0791 Add CalculateUpgrade::NULL 2018-05-10 12:59:57 -05:00
Rick Carlino e8e9368da0 Unbork specs 2018-05-08 08:48:39 -05:00
Rick Carlino 8371dbd861 Merge branch 'staging' of https://github.com/FarmBot/Farmbot-Web-App into seq_body_bug 2018-05-08 08:44:58 -05:00
Rick Carlino 7af7270f3b Possible fix I 2018-05-07 16:37:54 -05:00
Harry Brundage e6c57e6a90 Fix a test accidentally leaving User::SKIP_EMAIL_VALIDATION state dirty 2018-05-07 17:11:04 -04:00
Harry Brundage 97c8c51663 Fix a test failing when NO_EMAILS is true in the config for DeviceController#dump 2018-05-07 17:11:04 -04:00
Rick Carlino dcf37c4967 Update tests 2018-05-07 10:40:14 -05:00
Rick Carlino 9dfa5c57bc [WIP] Add new meta fields to data dump 2018-05-07 09:57:02 -05:00
Rick Carlino 27c730ea13
Merge branch 'staging' into docs_cleanup 2018-05-04 16:15:47 -05:00
Rick Carlino 019b231a2c Tests 2018-05-04 13:26:53 -05:00
Rick Carlino cea0028bb7 Merge branch 'staging' of https://github.com/FarmBot/Farmbot-Web-App into local_images 2018-05-04 11:55:48 -05:00
Rick Carlino 85cb133025
Merge branch 'staging' into docs_cleanup 2018-05-04 11:38:15 -05:00
Rick Carlino 34a39f38fc Remove YAGNI stuff from corpus controller 2018-05-04 10:42:51 -05:00
Rick Carlino ab242637b8 Add more export resources 2018-05-04 09:11:52 -05:00
Rick Carlino 0751e5f42f Specs for stub policy use case 2018-05-04 07:20:49 -05:00
Rick Carlino 43f68b7b30 Done with tests for requestAccountExport() 2018-05-03 10:42:12 -05:00
Rick Carlino 320f902eb4 Stub out the `NO_EMAILS` version of data dump 2018-05-02 16:40:25 -05:00
Rick Carlino 92ac9a7619 Fix issue where data_dump `status` where erroneously `inactive` 2018-05-02 14:56:47 -05:00
Rick Carlino 831e4098bc Re-enable call to user#reset_confirmation_token 2018-05-01 17:17:47 -05:00
Rick Carlino 936a269000
Merge branch 'staging' into reset-confirmation-tokens 2018-05-01 17:10:05 -05:00
Rick Carlino 1a49ec9d2d Merge branch 'no-emails-update-user-test' of https://github.com/airhorns/Farmbot-Web-App into no-emails-update-user-test 2018-05-01 16:36:32 -05:00
Harry Brundage b1ec335ebc Reenable confirmation token resetting for user email updates
I think this functionality was accidentally disabled in
65b044d7a8 . When a user changes their
email, an email is sent to the new email to ensure the user actually
owns that new email and isn't sending emails to people that aren't them. A secret token is
sent in that email and the user is only allowed to change their email if
they can prove they know the secret that was only sent to that email.

This scheme breaks down if the secret is shared with multiple emails.
Not that this is likely, but a user *could* change their email once to
an email they control, and get a secret to confirm that email. If that
user then changed their email again to a target email they want to spam,
and they knew that the same confirmation secret was used to confirm that
second new email, they could craft and visit a link that confirmed it
without ever having recieved the second confirmation email. That would
allow them to spam the target email if the application sends lots of
emails.

Long story short, the app used to this, and while its a bit farfetched
it may as well continue to do this.

This commit uncomments the line and adds a test.
2018-05-01 10:36:52 -04:00
Harry Brundage 2143ae2394 Make Users::Update update emails when NO_EMAILS is set
With NO_EMAILS set (say in a dev environment), some pieces of the User update mutation are skipped. Running the tests for Users::Update on a fresh clone of master with NO_EMAILS set had a failing test:

```
Failures:

  1) Users::Update changes email addresses
     Failure/Error: expect(u.unconfirmed_email?).to be true

       expected true
            got false
     # ./spec/mutations/users/update_spec.rb:31:in `block (2 levels) in <top (required)>'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/rspec:23:in `load'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/rspec:23:in `<top (required)>'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
```

This test failed because it was expecting against the `unconfirmed_email` attribute, which in the NO_EMAILS case, isn't used at all. So, the test now checks if email verification is on, and expects against `unconfirmed_email` if so, and the actual `email` attribute otherwise.

Turns out, that test failed too! The actual code in `Users::Update` figured out that direct email mutations should be allowed when NO_EMAILS is set, but didn't pass that down to the `#update_attributes` call. I think this was just a small mistake because the code builds a list of attribute exclusions conditional on NO_EMAILS already, and just never uses it. This code was added in 65b044d7a8 which looks like it might not have been intended to hit master. No matter, easy fix!
2018-05-01 10:28:04 -04:00
Harry Brundage 7594dbe838 Make Users::Update update emails when NO_EMAILS is set
With NO_EMAILS set (say in a dev environment), some pieces of the User update mutation are skipped. Running the tests for Users::Update on a fresh clone of master with NO_EMAILS set had a failing test:

```
Failures:

  1) Users::Update changes email addresses
     Failure/Error: expect(u.unconfirmed_email?).to be true

       expected true
            got false
     # ./spec/mutations/users/update_spec.rb:31:in `block (2 levels) in <top (required)>'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/rspec:23:in `load'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/rspec:23:in `<top (required)>'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
     # /Users/airhorns/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
```

This test failed because it was expecting against the `unconfirmed_email` attribute, which in the NO_EMAILS case, isn't used at all. So, the test now checks if email verification is on, and expects against `unconfirmed_email` if so, and the actual `email` attribute otherwise.

Turns out, that test failed too! The actual code in `Users::Update` figured out that direct email mutations should be allowed when NO_EMAILS is set, but didn't pass that down to the `#update_attributes` call. I think this was just a small mistake because the code builds a list of attribute exclusions conditional on NO_EMAILS already, and just never uses it. This code was added in 65b044d7a8 which looks like it might not have been intended to hit master. No matter, easy fix!
2018-05-01 10:12:23 -04:00