syncing with upstream

This commit is contained in:
Senad Uka
2018-01-15 13:31:00 +01:00
parent bc646b86c2
commit fe35b0aa91
24 changed files with 325 additions and 149 deletions

View File

@@ -1,4 +1,5 @@
import unittest
import mock
from numpy.testing import assert_array_equal, assert_equal
from helix.constants.module_type import ModuleType
@@ -9,11 +10,15 @@ from helix.models.subarray import Subarray
from helix.presenters.panel_presenter import ProjectPresenter
from helix.constants.system_type import SystemType
from helix.constants.panel_type import PanelType
from test.test_helpers import feature_is_always_active
import flask_featureflags
flask_featureflags.is_active = feature_is_always_active
class PanelPresenterTest(unittest.TestCase):
def test_get_table_data_single_tilt_96cell(self):
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
panels = [
@@ -76,6 +81,7 @@ class PanelPresenterTest(unittest.TestCase):
actual_buildings = self.subject.get_buildings(buildings,60)
assert_array_equal(actual_buildings,expected_buildings)
#@mock.patch('flask_featureflags.is_active',side_effect=feature_is_always_active)
def test_get_corners_box_building(self):
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
buildings = [ [ [0, 0], [60, 0], [60,60], [0, 60] ] ] # big square
@@ -88,6 +94,7 @@ class PanelPresenterTest(unittest.TestCase):
actual_corners = self.subject.get_corners(buildings)
assert_array_equal(actual_corners,expected_corners)
#@mock.patch('flask_featureflags.is_active',side_effect=feature_is_always_active)
def test_get_corners_box_building_rotated_30_degrees(self):
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
buildings = [ [ [0, 0], [51.96, 30], [21.96, 81.96], [-30, 51.96] ] ] # big square
@@ -100,6 +107,7 @@ class PanelPresenterTest(unittest.TestCase):
actual_corners = self.subject.get_corners(buildings)
assert_array_equal(actual_corners,expected_corners)
#@mock.patch('flask_featureflags.is_active',side_effect=feature_is_always_active)
def test_get_corners_building(self):
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
buildings = [ [ [-3.42, 1.51], [-1.66, -1.64], [4.22, -0.87], [-0.8, 5.64]] ]
@@ -112,6 +120,7 @@ class PanelPresenterTest(unittest.TestCase):
actual_corners = self.subject.get_corners(buildings)
assert_array_equal(actual_corners,expected_corners)
#@mock.patch('flask_featureflags.is_active',side_effect=feature_is_always_active)
def test_get_corners_wild_building_with_big_angles(self):
self.subject = ProjectPresenter(SystemType.singleTilt, ModuleType.Cell96)
buildings = [ [ [-3.58, 3.32], [-0.78, -2.9], [-1.56,0.88], [0.66, -2.16], [1.5, 1.16], [2.72, 2.36], [-0.8, 5.64] ] ]