class RegionsStimulusControllerTest(BaseTransactionalControllerTest):
    """ Unit tests for RegionStimulusController """
    
    def setUp(self):
        """
        Sets up the environment for testing;
        creates a `RegionStimulusController`
        """
        self.init()
        self.region_s_c = RegionStimulusController()


    def tearDown(self):
        """ Cleans the testing environment """
        self.cleanup()


    def test_step_1(self):
        """
        Verifies that result dictionary has the expected keys / values after call to
        `step_1_submit(...)`
        """
        self.region_s_c.step_1_submit(1, 1)
        result_dict = self.region_s_c.step_1()
        self.assertEqual(result_dict['equationViewerUrl'], '/spatial/stimulus/region/get_equation_chart')
        self.assertTrue('fieldsPrefixes' in result_dict)
        self.assertEqual(result_dict['loadExistentEntityUrl'], '/spatial/stimulus/region/load_region_stimulus')
        self.assertEqual(result_dict['mainContent'], 'spatial/stimulus_region_step1_main')
        self.assertEqual(result_dict['next_step_url'], '/spatial/stimulus/region/step_1_submit')
class TestRegionsStimulusController(BaseTransactionalControllerTest):
    """ Unit tests for RegionStimulusController """
    def transactional_setup_method(self):
        """
        Sets up the environment for testing;
        creates a `RegionStimulusController`
        """
        self.init()
        self.region_s_c = RegionStimulusController()

    def transactional_teardown_method(self):
        """ Cleans the testing environment """
        self.cleanup()

    def test_step_1(self):
        """
        Verifies that result dictionary has the expected keys / values after call to
        `step_1_submit(...)`
        """
        self.region_s_c.step_1_submit(1, 1)
        result_dict = self.region_s_c.step_1()
        assert result_dict['baseUrl'] == '/spatial/stimulus/region'
        assert 'fieldsWithEvents' in result_dict
        assert result_dict[
            'loadExistentEntityUrl'] == '/spatial/stimulus/region/load_region_stimulus'
        assert result_dict[
            'mainContent'] == 'spatial/stimulus_region_step1_main'
        assert result_dict[
            'next_step_url'] == '/spatial/stimulus/region/step_1_submit'
Esempio n. 3
0
class RegionsStimulusControllerTest(BaseTransactionalControllerTest):
    """ Unit tests for RegionStimulusController """
    def setUp(self):
        """
        Sets up the environment for testing;
        creates a `RegionStimulusController`
        """
        self.init()
        self.region_s_c = RegionStimulusController()

    def tearDown(self):
        """ Cleans the testing environment """
        self.cleanup()

    def test_step_1(self):
        """
        Verifies that result dictionary has the expected keys / values after call to
        `step_1_submit(...)`
        """
        self.region_s_c.step_1_submit(1, 1)
        result_dict = self.region_s_c.step_1()
        self.assertEqual(result_dict['equationViewerUrl'],
                         '/spatial/stimulus/region/get_equation_chart')
        self.assertTrue('fieldsPrefixes' in result_dict)
        self.assertEqual(result_dict['loadExistentEntityUrl'],
                         '/spatial/stimulus/region/load_region_stimulus')
        self.assertEqual(result_dict['mainContent'],
                         'spatial/stimulus_region_step1_main')
        self.assertEqual(result_dict['next_step_url'],
                         '/spatial/stimulus/region/step_1_submit')