예제 #1
0
    def test_reset_config_file(self):

        # Check reset_config and get_config return the same values

        tools.reset_config_file()
        config = tools.get_config_file()
        self.assertEqual(config['plotly_domain'], 'https://plot.ly')
        self.assertEqual(config['plotly_streaming_domain'], 'stream.plot.ly')
예제 #2
0
    def test_reset_config_file(self):

        # Check reset_config and get_config return the same values

        tools.reset_config_file()
        config = tools.get_config_file()
        self.assertEqual(config["plotly_domain"], "https://plotly.com")
        self.assertEqual(config["plotly_streaming_domain"],
                         "stream.plotly.com")
예제 #3
0
def get_config():
    """Returns either module config or file config."""
    config = tools.get_config_file()
    session_config = session.get_session_config()
    for config_key in config:

        # checking for not false, but truthy value here is the desired behavior
        session_value = session_config.get(config_key)
        if session_value is False or session_value:
            config[config_key] = session_value
    return config
예제 #4
0
 def test_set_config_updates_plot_options(self):
     original_config = tls.get_config_file()
     new_options = {
         'world_readable': not original_config['world_readable'],
         'auto_open': not original_config['auto_open'],
         'sharing': ('public' if original_config['world_readable'] is False
                     else 'secret')
     }
     tls.set_config_file(**new_options)
     options = py._plot_option_logic({})
     for key in new_options:
         self.assertEqual(new_options[key], options[key])
예제 #5
0
    def test_set_config_file_two_entries(self):

        # Check set_config and get_config given only two entries return the
        # same values

        domain, streaming_domain = 'this', 'thing'
        tools.set_config_file(plotly_domain=domain,
                              plotly_streaming_domain=streaming_domain)
        config = tools.get_config_file()
        self.assertEqual(config['plotly_domain'], domain)
        self.assertEqual(config['plotly_streaming_domain'], streaming_domain)
        tools.reset_config_file()
예제 #6
0
 def test_set_config_updates_plot_options(self):
     original_config = tls.get_config_file()
     new_options = {
         'world_readable': not original_config['world_readable'],
         'auto_open': not original_config['auto_open'],
         'sharing': ('public' if original_config['world_readable'] is False
                     else 'secret')
     }
     tls.set_config_file(**new_options)
     options = py._plot_option_logic({})
     for key in new_options:
         self.assertEqual(new_options[key], options[key])
예제 #7
0
 def test_set_config_updates_plot_options(self):
     original_config = tls.get_config_file()
     new_options = {
         "world_readable":
         not original_config["world_readable"],
         "auto_open":
         not original_config["auto_open"],
         "sharing": ("public" if original_config["world_readable"] is False
                     else "secret"),
     }
     tls.set_config_file(**new_options)
     options = py._plot_option_logic({})
     for key in new_options:
         self.assertEqual(new_options[key], options[key])
예제 #8
0
 def test_default_options(self):
     options = py._plot_option_logic({})
     config_options = tls.get_config_file()
     for key in options:
         if key in config_options:
             self.assertEqual(options[key], config_options[key])
예제 #9
0
 def test_default_options(self):
     options = py._plot_option_logic({})
     config_options = tls.get_config_file()
     for key in options:
         if key != 'fileopt' and key in config_options:
             self.assertEqual(options[key], config_options[key])