Add CalculateUpgrade::NULL

pull/844/head
Rick Carlino 2018-05-10 12:59:57 -05:00
parent 15e4be4bcd
commit d95f5b0791
3 changed files with 5 additions and 3 deletions

View File

@ -170,7 +170,7 @@ private
def fbos_version
when_farmbot_os do
Gem::Version::new(pretty_ua.upcase.split("/").last.split(" ").first)
end || EXPECTED_VER.bump
end || CalculateUpgrade::NULL
end
# This is how we lock old versions of FBOS out of the API:

View File

@ -1,9 +1,10 @@
class CalculateUpgrade < Mutations::Command
NULL = Gem::Version::new("0.0.0")
MEDIUM_OLDISH = Gem::Version.new("5.0.9")
LEGACY_CUTOFF = Gem::Version.new("5.0.6")
# For extremely old versions:
OLD_OS_URL = "https://api.github.com/repos/farmbot/farmbot_os"+
OLD_OS_URL = "https://api.github.com/repos/farmbot/farmbot_os" +
"/releases/8772352"
# For versions that are slightly out of date:
@ -26,4 +27,4 @@ class CalculateUpgrade < Mutations::Command
return MID_OS_URL if version <= MEDIUM_OLDISH
return OS_RELEASE
end
end
end

View File

@ -50,6 +50,7 @@ describe SessionToken do
expect(test_case["5.0.8"]).to eq(CalculateUpgrade::MID_OS_URL)
expect(test_case["5.0.9"]).to eq(CalculateUpgrade::MID_OS_URL)
expect(test_case["6.0.1"]).to eq(CalculateUpgrade::OS_RELEASE)
expect(test_case["0.0.0"]).to eq(CalculateUpgrade::OLD_OS_URL)
end
it "doesn't honor expired tokens" do