Commit 52742a46583348c4879fb0f597ab7de48ebebdf1
1 parent
d296493b
Exists in
master
and in
4 other branches
Testing set plugin namespace
Showing
1 changed file
with
23 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +from mock import patch | |
| 2 | + | |
| 3 | +from django.test import TestCase | |
| 4 | +from django.apps import AppConfig | |
| 5 | + | |
| 6 | +from colab.plugins.utils.apps import ColabPluginAppConfig | |
| 7 | + | |
| 8 | + | |
| 9 | +class AppsTest(TestCase): | |
| 10 | + | |
| 11 | + @patch.object(AppConfig, '_path_from_module') | |
| 12 | + @patch('colab.plugins.utils.apps.get_plugin_config') | |
| 13 | + def test_set_namespace(self, get_plugin_config_mock, | |
| 14 | + path_from_module_mock): | |
| 15 | + path_from_module_mock.return_value = "/fake/path" | |
| 16 | + | |
| 17 | + get_plugin_config_mock.return_value = {'urls': {}} | |
| 18 | + conf = get_plugin_config_mock() | |
| 19 | + | |
| 20 | + ColabPluginAppConfig("test", "test_app") | |
| 21 | + | |
| 22 | + self.assertIn('namespace', conf['urls']) | |
| 23 | + self.assertEquals(None, conf['urls']['namespace']) | ... | ... |