Ejemplo 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)
Ejemplo 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')
Ejemplo 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)
Ejemplo 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'))
Ejemplo 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')
Ejemplo 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)
Ejemplo 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)
Ejemplo 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))
Ejemplo 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)