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)
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')
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)
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'))
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)
def test_organization_in_context_data(self): response = self.client.get(reverse('login')) organization = get_local_setting('ORGANIZATION', 'LabCIRS') self.assertIn(organization, str(response))