Esempio n. 1
0
 def test_key_generator(self):
     """New key has to be differen from old one and be 50 chars long"""
     old_key = get_local_setting('SECRET_KEY')
     call_command('makesecretkey')
     new_key = get_local_setting('SECRET_KEY')
     self.assertEqual(len(new_key), 50)
     self.assertNotEqual(old_key, new_key)
Esempio n. 2
0
 def test_get_local_conf_returns_default_only_if_value_empty(self):
     """The name should be the default LabCIRS."""
     self.write_test_config(self.config_file, '')
     organization = get_local_setting('ORGANIZATION',
                                      self.default,
                                      config_file=self.config_file)
     self.assertEqual(organization, 'LabCIRS')
Esempio n. 3
0
 def test_get_local_conf_accepts_default(self):
     """Althoug default is specifed the stored name should be used."""
     self.write_test_config(self.config_file, self.name)
     organization = get_local_setting('ORGANIZATION',
                                      self.default,
                                      config_file=self.config_file)
     self.assertEqual(organization, self.name)
Esempio n. 4
0
 def test_organization_in_context_data(self):
     response = self.client.get(reverse('login'))
     organization = get_local_setting('ORGANIZATION', 'LabCIRS')
     self.assertIn(organization, response.content.decode('utf-8'))
Esempio n. 5
0
 def test_get_local_conf_returns_default_only_if_value_empty(self):
     """The name should be the default LabCIRS."""
     self.write_test_config(self.config_file, '')
     organization = get_local_setting('ORGANIZATION', self.default,
                                      config_file=self.config_file)
     self.assertEqual(organization, 'LabCIRS')
Esempio n. 6
0
 def test_get_local_conf_accepts_default(self):
     """Althoug default is specifed the stored name should be used."""
     self.write_test_config(self.config_file, self.name)
     organization = get_local_setting('ORGANIZATION', self.default,
                                      config_file=self.config_file)
     self.assertEqual(organization, self.name)
Esempio n. 7
0
 def test_custom_organization_name(self):
     """Use the stored name."""
     self.write_test_config(self.config_file, self.name)
     organization = get_local_setting('ORGANIZATION',
                                      config_file=self.config_file)
     self.assertEqual(organization, self.name)
Esempio n. 8
0
 def test_organization_in_context_data(self):
     response = self.client.get(reverse('login'))
     organization = get_local_setting('ORGANIZATION', 'LabCIRS')
     self.assertIn(organization, str(response))
Esempio n. 9
0
 def test_custom_organization_name(self):
     """Use the stored name."""
     self.write_test_config(self.config_file, self.name)
     organization = get_local_setting('ORGANIZATION',
                                      config_file=self.config_file)
     self.assertEqual(organization, self.name)